mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2025-12-12 15:42:11 -05:00
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.43 Removed upstreamed: generic/backport-6.12/612-07-v6.17-net-dsa-b53-prevent-SWITCH_CTRL-access-on-BCM5325.patch[1] generic-backport/612-08-v6.17-net-dsa-b53-fix-IP_MULTICAST_CTRL-on-BCM5325.patch[2] generic-backport/612-09-v6.17-net-dsa-b53-prevent-DIS_LEARNING-access-on-BCM5325.patch[3] generic-backport/612-11-v6.17-net-dsa-b53-prevent-GMII_PORT_OVERRIDE_CTRL-access-on-BCM5325.patch[4] generic-backport/612-14-v6.17-net-dsa-b53-ensure-BCM5325-PHYs-are-enabled.patch[5] generic-backport/830-v6.17-Revert-leds-trigger-netdev-Configure-LED-blink-inter.patch[6] bcm27xx/patches-6.12/950-0100-media-tc358743-Increase-FIFO-level-to-374.patch[7] bcm27xx/patches-6.12/950-0102-media-tc358743-Check-I2C-succeeded-during-probe.patch[8] bcm27xx/patches-6.12/950-0107-media-tc358743-Return-an-appropriate-colorspace-from.patch[9] bcm27xx/patches-6.12/950-0341-Allow-RESET_BRCMSTB-on-ARCH_BCM2835.patch[10] lantiq/patches-6.12/102-11-v6.17-MIPS-lantiq-falcon-sysctrl-fix-request-memory-check-.patch[11] lantiq/patches-6.12/102-12-v6.17-MIPS-vpe-mt-add-missing-prototypes-for-vpe_-alloc-st.patch[12] qualcommax/patches-6.12/0170-clk-qcom-gcc-ipq8074-fix-broken-freq-table-for-nss_port6_tx_clk_src.patch[13] generic/backport-6.12/612-13-v6.17-net-dsa-b53-fix-b53_imp_vlan_setup-for-BCM5325.patch[14] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f16f96ccfe56ef2d627c20ba47f6d9d7dea40f5b 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=394bd12d1f93ed2fa0fa1d8f31ffd3c344681e85 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=9f45e4858f8096bb27f9a2c75fc24a538dffad67 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=15cf46cc6ecc7a54b397294675d11c379ddf69ef 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=0d250ad617a035904744cef74a5d5dc43d0199b9 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=cb9bb872366e10fa42e1e0200a0c2e5d05a27bec 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f25d566c5674decd0051a3e624805fc1524729bf 8. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=3e03ee3b65baeac4c253b30650492ffffad9b608 9. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=b42b107293b52ac8d46238815b1071138a47a7e4 10. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=e285cdb9d2e4ba2e4515ae898f92e9f38be64eb3 11. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=1e9079ff83eac962bc3b1e2fbad73b2f7d5256f4 12. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=8520c843d9a2770012f23da08e4e2ccf1bb05ba6 13. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f1c5c55fb6cda312f5ed15505588caaf05a69043 14. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=757955c80663ac3df7053abaf6fcc75051ef7a7c Build system: x86/64 (Intel N150 based) Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64-glibc Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64-glibc Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/19618 Signed-off-by: Robert Marko <robimarko@gmail.com>
202 lines
6.9 KiB
Diff
202 lines
6.9 KiB
Diff
From a779a482fb9b9f8fcdf8b2519c789b4b9bb5dd05 Mon Sep 17 00:00:00 2001
|
|
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Fri, 7 Jul 2017 16:56:48 +0200
|
|
Subject: build: add a hack for removing non-essential module info
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
include/linux/module.h | 13 ++++++++-----
|
|
include/linux/moduleparam.h | 15 ++++++++++++---
|
|
init/Kconfig | 7 +++++++
|
|
kernel/module.c | 5 ++++-
|
|
scripts/mod/modpost.c | 12 ++++++++++++
|
|
5 files changed, 43 insertions(+), 9 deletions(-)
|
|
|
|
--- a/include/linux/module.h
|
|
+++ b/include/linux/module.h
|
|
@@ -166,6 +166,7 @@ struct module_kobject *lookup_or_create_
|
|
|
|
/* Generic info of form tag = "info" */
|
|
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
|
|
+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info)
|
|
|
|
/* For userspace: you can also call me... */
|
|
#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
|
|
@@ -241,12 +242,12 @@ struct module_kobject *lookup_or_create_
|
|
* Author(s), use "Name <email>" or just "Name", for multiple
|
|
* authors use multiple MODULE_AUTHOR() statements/lines.
|
|
*/
|
|
-#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
|
|
+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author)
|
|
|
|
/* What your module does. */
|
|
-#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
|
|
+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description)
|
|
|
|
-#ifdef MODULE
|
|
+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED)
|
|
/* Creates an alias so file2alias.c can find device table. */
|
|
#define MODULE_DEVICE_TABLE(type, name) \
|
|
extern typeof(name) __mod_##type##__##name##_device_table \
|
|
@@ -273,7 +274,9 @@ extern typeof(name) __mod_##type##__##na
|
|
*/
|
|
|
|
#if defined(MODULE) || !defined(CONFIG_SYSFS)
|
|
-#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
|
|
+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version)
|
|
+#elif defined(CONFIG_MODULE_STRIPPED)
|
|
+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version)
|
|
#else
|
|
#define MODULE_VERSION(_version) \
|
|
MODULE_INFO(version, _version); \
|
|
@@ -296,7 +299,7 @@ extern typeof(name) __mod_##type##__##na
|
|
/* Optional firmware file (or files) needed by the module
|
|
* format is simply firmware file name. Multiple firmware
|
|
* files require multiple MODULE_FIRMWARE() specifiers */
|
|
-#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
|
|
+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware)
|
|
|
|
#define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, __stringify(ns))
|
|
|
|
--- a/include/linux/moduleparam.h
|
|
+++ b/include/linux/moduleparam.h
|
|
@@ -20,6 +20,16 @@
|
|
/* Chosen so that structs with an unsigned long line up. */
|
|
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
|
|
|
|
+/* This struct is here for syntactic coherency, it is not used */
|
|
+#define __MODULE_INFO_DISABLED(name) \
|
|
+ struct __UNIQUE_ID(name) {}
|
|
+
|
|
+#ifdef CONFIG_MODULE_STRIPPED
|
|
+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name)
|
|
+#else
|
|
+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info)
|
|
+#endif
|
|
+
|
|
#define __MODULE_INFO(tag, name, info) \
|
|
static const char __UNIQUE_ID(name)[] \
|
|
__used __section(".modinfo") __aligned(1) \
|
|
@@ -31,7 +41,7 @@
|
|
/* One for each parameter, describing how to use it. Some files do
|
|
multiple of these per line, so can't just use MODULE_INFO. */
|
|
#define MODULE_PARM_DESC(_parm, desc) \
|
|
- __MODULE_INFO(parm, _parm, #_parm ":" desc)
|
|
+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc)
|
|
|
|
struct kernel_param;
|
|
|
|
--- a/kernel/module/Kconfig
|
|
+++ b/kernel/module/Kconfig
|
|
@@ -402,4 +402,11 @@ config MODULES_TREE_LOOKUP
|
|
def_bool y
|
|
depends on PERF_EVENTS || TRACING || CFI_CLANG
|
|
|
|
+config MODULE_STRIPPED
|
|
+ bool "Reduce module size"
|
|
+ depends on MODULES
|
|
+ help
|
|
+ Remove module parameter descriptions, author info, version, aliases,
|
|
+ device tables, etc.
|
|
+
|
|
endif # MODULES
|
|
--- a/kernel/module/main.c
|
|
+++ b/kernel/module/main.c
|
|
@@ -1001,6 +1001,7 @@ size_t modinfo_attrs_count = ARRAY_SIZE(
|
|
|
|
static const char vermagic[] = VERMAGIC_STRING;
|
|
|
|
+#if defined(CONFIG_MODVERSIONS) || !defined(CONFIG_MODULE_STRIPPED)
|
|
int try_to_force_load(struct module *mod, const char *reason)
|
|
{
|
|
#ifdef CONFIG_MODULE_FORCE_LOAD
|
|
@@ -1012,6 +1013,7 @@ int try_to_force_load(struct module *mod
|
|
return -ENOEXEC;
|
|
#endif
|
|
}
|
|
+#endif
|
|
|
|
/* Parse tag=value strings from .modinfo section */
|
|
char *module_next_tag_pair(char *string, unsigned long *secsize)
|
|
@@ -2095,9 +2097,11 @@ static void module_augment_kernel_taints
|
|
|
|
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
|
|
{
|
|
- const char *modmagic = get_modinfo(info, "vermagic");
|
|
int err;
|
|
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
+ const char *modmagic = get_modinfo(info, "vermagic");
|
|
+
|
|
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
|
|
modmagic = NULL;
|
|
|
|
@@ -2111,6 +2115,7 @@ static int check_modinfo(struct module *
|
|
info->name, modmagic, vermagic);
|
|
return -ENOEXEC;
|
|
}
|
|
+#endif
|
|
|
|
err = check_modinfo_livepatch(mod, info);
|
|
if (err)
|
|
--- a/scripts/mod/modpost.c
|
|
+++ b/scripts/mod/modpost.c
|
|
@@ -1601,7 +1601,9 @@ static void read_symbols(const char *mod
|
|
symname = remove_dot(info.strtab + sym->st_name);
|
|
|
|
handle_symbol(mod, &info, sym, symname);
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
handle_moddevtable(mod, &info, sym, symname);
|
|
+#endif
|
|
}
|
|
|
|
check_sec_ref(mod, &info);
|
|
@@ -1758,7 +1760,9 @@ static void add_header(struct buffer *b,
|
|
buf_printf(b, "#include <linux/export-internal.h>\n");
|
|
buf_printf(b, "#include <linux/compiler.h>\n");
|
|
buf_printf(b, "\n");
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
|
|
+#endif
|
|
buf_printf(b, "\n");
|
|
buf_printf(b, "__visible struct module __this_module\n");
|
|
buf_printf(b, "__section(\".gnu.linkonce.this_module\") = {\n");
|
|
@@ -1772,11 +1776,13 @@ static void add_header(struct buffer *b,
|
|
buf_printf(b, "\t.arch = MODULE_ARCH_INIT,\n");
|
|
buf_printf(b, "};\n");
|
|
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
if (!external_module)
|
|
buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
|
|
|
|
if (strstarts(mod->name, "drivers/staging"))
|
|
buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
|
|
+#endif
|
|
|
|
if (strstarts(mod->name, "tools/testing"))
|
|
buf_printf(b, "\nMODULE_INFO(test, \"Y\");\n");
|
|
@@ -1886,11 +1892,13 @@ static void add_depends(struct buffer *b
|
|
|
|
static void add_srcversion(struct buffer *b, struct module *mod)
|
|
{
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
if (mod->srcversion[0]) {
|
|
buf_printf(b, "\n");
|
|
buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n",
|
|
mod->srcversion);
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
static void write_buf(struct buffer *b, const char *fname)
|
|
@@ -1973,7 +1981,9 @@ static void write_mod_c_file(struct modu
|
|
add_exported_symbols(&buf, mod);
|
|
add_versions(&buf, mod);
|
|
add_depends(&buf, mod);
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
add_moddevtable(&buf, mod);
|
|
+#endif
|
|
add_srcversion(&buf, mod);
|
|
|
|
ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name);
|