Skip to content

Commit daa22f5

Browse files
committed
Merge tag 'modules-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux
Pull modules updates from Luis Chamberlain: "Summary of the changes worth highlighting from most interesting to boring below: - Christoph Hellwig's symbol_get() fix to Nvidia's efforts to circumvent the protection he put in place in year 2020 to prevent proprietary modules from using GPL only symbols, and also ensuring proprietary modules which export symbols grandfather their taint. That was done through year 2020 commit 262e6ae ("modules: inherit TAINT_PROPRIETARY_MODULE"). Christoph's new fix is done by clarifing __symbol_get() was only ever intended to prevent module reference loops by Linux kernel modules and so making it only find symbols exported via EXPORT_SYMBOL_GPL(). The circumvention tactic used by Nvidia was to use symbol_get() to purposely swift through proprietary module symbols and completely bypass our traditional EXPORT_SYMBOL*() annotations and community agreed upon restrictions. A small set of preamble patches fix up a few symbols which just needed adjusting for this on two modules, the rtc ds1685 and the networking enetc module. Two other modules just needed some build fixing and removal of use of __symbol_get() as they can't ever be modular, as was done by Arnd on the ARM pxa module and Christoph did on the mmc au1xmmc driver. This is a good reminder to us that symbol_get() is just a hack to address things which should be fixed through Kconfig at build time as was done in the later patches, and so ultimately it should just go. - Extremely late minor fix for old module layout 055f23b ("module: check for exit sections in layout_sections() instead of module_init_section()") by James Morse for arm64. Note that this layout thing is old, it is *not* Song Liu's commit ac3b432 ("module: replace module_layout with module_memory"). The issue however is very odd to run into and so there was no hurry to get this in fast. - Although the fix did not go through the modules tree I'd like to highlight the fix by Peter Zijlstra in commit 5409730 ("x86/static_call: Fix __static_call_fixup()") now merged in your tree which came out of what was originally suspected to be a fallout of the the newer module layout changes by Song Liu commit ac3b432 ("module: replace module_layout with module_memory") instead of module_init_section()"). Thanks to the report by Christian Bricart and the debugging by Song Liu & Peter that turned to be noted as a kernel regression in place since v5.19 through commit ee88d36 ("x86,static_call: Use alternative RET encoding"). I highlight this to reflect and clarify that we haven't seen more fallout from ac3b432 ("module: replace module_layout with module_memory"). - RISC-V toolchain got mapping symbol support which prefix symbols with "$" to help with alignment considerations for disassembly. This is used to differentiate between incompatible instruction encodings when disassembling. RISC-V just matches what ARM/AARCH64 did for alignment considerations and Palmer Dabbelt extended is_mapping_symbol() to accept these symbols for RISC-V. We already had support for this for all architectures but it also checked for the second character, the RISC-V check Dabbelt added was just for the "$". After a bit of testing and fallout on linux-next and based on feedback from Masahiro Yamada it was decided to simplify the check and treat the first char "$" as unique for all architectures, and so we no make is_mapping_symbol() for all archs if the symbol starts with "$". The most relevant commit for this for RISC-V on binutils was: https://sourceware.org/pipermail/binutils/2021-July/117350.html - A late fix by Andrea Righi (today) to make module zstd decompression use vmalloc() instead of kmalloc() to account for large compressed modules. I suspect we'll see similar things for other decompression algorithms soon. - samples/hw_breakpoint minor fixes by Rong Tao, Arnd Bergmann and Chen Jiahao" * tag 'modules-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux: module/decompress: use vmalloc() for zstd decompression workspace kallsyms: Add more debug output for selftest ARM: module: Use module_init_layout_section() to spot init sections arm64: module: Use module_init_layout_section() to spot init sections module: Expose module_init_layout_section() modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff net: enetc: use EXPORT_SYMBOL_GPL for enetc_phc_index mmc: au1xmmc: force non-modular build and remove symbol_get usage ARM: pxa: remove use of symbol_get() samples/hw_breakpoint: mark sample_hbp as static samples/hw_breakpoint: fix building without module unloading samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000' modpost, kallsyms: Treat add '$'-prefixed symbols as mapping symbols kernel: params: Remove unnecessary ‘0’ values from err module: Ignore RISC-V mapping symbols too
2 parents d68b4b6 + a419bea commit daa22f5

File tree

17 files changed

+55
-70
lines changed

17 files changed

+55
-70
lines changed

arch/arm/kernel/module-plts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
251251
/* sort by type and symbol index */
252252
sort(rels, numrels, sizeof(Elf32_Rel), cmp_rel, NULL);
253253

254-
if (strncmp(secstrings + dstsec->sh_name, ".init", 5) != 0)
254+
if (!module_init_layout_section(secstrings + dstsec->sh_name))
255255
core_plts += count_plts(syms, dstsec->sh_addr, rels,
256256
numrels, s->sh_info);
257257
else

arch/arm/mach-pxa/sharpsl_pm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ void sharpsl_battery_kick(void)
216216
{
217217
schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(125));
218218
}
219-
EXPORT_SYMBOL(sharpsl_battery_kick);
220-
221219

222220
static void sharpsl_battery_thread(struct work_struct *private_)
223221
{

arch/arm/mach-pxa/spitz.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
#include <linux/kernel.h>
12-
#include <linux/module.h> /* symbol_get ; symbol_put */
1312
#include <linux/platform_device.h>
1413
#include <linux/delay.h>
1514
#include <linux/gpio_keys.h>
@@ -518,17 +517,6 @@ static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
518517
},
519518
};
520519

521-
static void spitz_bl_kick_battery(void)
522-
{
523-
void (*kick_batt)(void);
524-
525-
kick_batt = symbol_get(sharpsl_battery_kick);
526-
if (kick_batt) {
527-
kick_batt();
528-
symbol_put(sharpsl_battery_kick);
529-
}
530-
}
531-
532520
static struct gpiod_lookup_table spitz_lcdcon_gpio_table = {
533521
.dev_id = "spi2.1",
534522
.table = {
@@ -556,7 +544,7 @@ static struct corgi_lcd_platform_data spitz_lcdcon_info = {
556544
.max_intensity = 0x2f,
557545
.default_intensity = 0x1f,
558546
.limit_mask = 0x0b,
559-
.kick_battery = spitz_bl_kick_battery,
547+
.kick_battery = sharpsl_battery_kick,
560548
};
561549

562550
static struct spi_board_info spitz_spi_devices[] = {

arch/arm64/kernel/module-plts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
339339
if (nents)
340340
sort(rels, nents, sizeof(Elf64_Rela), cmp_rela, NULL);
341341

342-
if (!str_has_prefix(secstrings + dstsec->sh_name, ".init"))
342+
if (!module_init_layout_section(secstrings + dstsec->sh_name))
343343
core_plts += count_plts(syms, rels, numrels,
344344
sechdrs[i].sh_info, dstsec);
345345
else

arch/mips/alchemy/devboards/db1000.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/interrupt.h>
1515
#include <linux/leds.h>
1616
#include <linux/mmc/host.h>
17-
#include <linux/module.h>
1817
#include <linux/platform_device.h>
1918
#include <linux/pm.h>
2019
#include <linux/spi/spi.h>
@@ -167,12 +166,7 @@ static struct platform_device db1x00_audio_dev = {
167166

168167
static irqreturn_t db1100_mmc_cd(int irq, void *ptr)
169168
{
170-
void (*mmc_cd)(struct mmc_host *, unsigned long);
171-
/* link against CONFIG_MMC=m */
172-
mmc_cd = symbol_get(mmc_detect_change);
173-
mmc_cd(ptr, msecs_to_jiffies(500));
174-
symbol_put(mmc_detect_change);
175-
169+
mmc_detect_change(ptr, msecs_to_jiffies(500));
176170
return IRQ_HANDLED;
177171
}
178172

arch/mips/alchemy/devboards/db1200.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/gpio.h>
1111
#include <linux/i2c.h>
1212
#include <linux/init.h>
13-
#include <linux/module.h>
1413
#include <linux/interrupt.h>
1514
#include <linux/io.h>
1615
#include <linux/leds.h>
@@ -340,14 +339,7 @@ static irqreturn_t db1200_mmc_cd(int irq, void *ptr)
340339

341340
static irqreturn_t db1200_mmc_cdfn(int irq, void *ptr)
342341
{
343-
void (*mmc_cd)(struct mmc_host *, unsigned long);
344-
345-
/* link against CONFIG_MMC=m */
346-
mmc_cd = symbol_get(mmc_detect_change);
347-
if (mmc_cd) {
348-
mmc_cd(ptr, msecs_to_jiffies(200));
349-
symbol_put(mmc_detect_change);
350-
}
342+
mmc_detect_change(ptr, msecs_to_jiffies(200));
351343

352344
msleep(100); /* debounce */
353345
if (irq == DB1200_SD0_INSERT_INT)
@@ -431,14 +423,7 @@ static irqreturn_t pb1200_mmc1_cd(int irq, void *ptr)
431423

432424
static irqreturn_t pb1200_mmc1_cdfn(int irq, void *ptr)
433425
{
434-
void (*mmc_cd)(struct mmc_host *, unsigned long);
435-
436-
/* link against CONFIG_MMC=m */
437-
mmc_cd = symbol_get(mmc_detect_change);
438-
if (mmc_cd) {
439-
mmc_cd(ptr, msecs_to_jiffies(200));
440-
symbol_put(mmc_detect_change);
441-
}
426+
mmc_detect_change(ptr, msecs_to_jiffies(200));
442427

443428
msleep(100); /* debounce */
444429
if (irq == PB1200_SD1_INSERT_INT)

arch/mips/alchemy/devboards/db1300.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/interrupt.h>
1818
#include <linux/ata_platform.h>
1919
#include <linux/mmc/host.h>
20-
#include <linux/module.h>
2120
#include <linux/mtd/mtd.h>
2221
#include <linux/mtd/platnand.h>
2322
#include <linux/platform_device.h>
@@ -459,14 +458,7 @@ static irqreturn_t db1300_mmc_cd(int irq, void *ptr)
459458

460459
static irqreturn_t db1300_mmc_cdfn(int irq, void *ptr)
461460
{
462-
void (*mmc_cd)(struct mmc_host *, unsigned long);
463-
464-
/* link against CONFIG_MMC=m. We can only be called once MMC core has
465-
* initialized the controller, so symbol_get() should always succeed.
466-
*/
467-
mmc_cd = symbol_get(mmc_detect_change);
468-
mmc_cd(ptr, msecs_to_jiffies(200));
469-
symbol_put(mmc_detect_change);
461+
mmc_detect_change(ptr, msecs_to_jiffies(200));
470462

471463
msleep(100); /* debounce */
472464
if (irq == DB1300_SD1_INSERT_INT)

drivers/mmc/host/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,12 @@ config MMC_ALCOR
526526
of Alcor Micro PCI-E card reader
527527

528528
config MMC_AU1X
529-
tristate "Alchemy AU1XX0 MMC Card Interface support"
529+
bool "Alchemy AU1XX0 MMC Card Interface support"
530530
depends on MIPS_ALCHEMY
531+
depends on MMC=y
531532
help
532533
This selects the AMD Alchemy(R) Multimedia card interface.
533-
If you have a Alchemy platform with a MMC slot, say Y or M here.
534+
If you have a Alchemy platform with a MMC slot, say Y here.
534535

535536
If unsure, say N.
536537

drivers/net/ethernet/freescale/enetc/enetc_ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "enetc.h"
99

1010
int enetc_phc_index = -1;
11-
EXPORT_SYMBOL(enetc_phc_index);
11+
EXPORT_SYMBOL_GPL(enetc_phc_index);
1212

1313
static struct ptp_clock_info enetc_ptp_caps = {
1414
.owner = THIS_MODULE,

drivers/rtc/rtc-ds1685.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ ds1685_rtc_poweroff(struct platform_device *pdev)
14321432
unreachable();
14331433
}
14341434
}
1435-
EXPORT_SYMBOL(ds1685_rtc_poweroff);
1435+
EXPORT_SYMBOL_GPL(ds1685_rtc_poweroff);
14361436
/* ----------------------------------------------------------------------- */
14371437

14381438

0 commit comments

Comments
 (0)