]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kallsyms: Increase maximum kernel symbol length to 512
authorMiguel Ojeda <ojeda@kernel.org>
Mon, 5 Apr 2021 03:03:50 +0000 (05:03 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 12 Apr 2021 18:54:22 +0000 (20:54 +0200)
Rust symbols can become quite long due to namespacing introduced
by modules, types, traits, generics, etc. For instance, for:

    pub mod my_module {
        pub struct MyType;
        pub struct MyGenericType<T>(T);

        pub trait MyTrait {
            fn my_method() -> u32;
        }

        impl MyTrait for MyGenericType<MyType> {
            fn my_method() -> u32 {
                42
            }
        }
    }

generates a symbol of length 96 when using the upcoming v0 mangling scheme:

    _RNvXNtCshGpAVYOtgW1_7example9my_moduleINtB2_13MyGenericTypeNtB2_6MyTypeENtB2_7MyTrait9my_method

At the moment, Rust symbols may reach up to 300 in length.
Setting 512 as the maximum seems like a reasonable choice to
keep some headroom.

Co-developed-by: Alex Gaynor <alex.gaynor@gmail.com>
Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com>
Co-developed-by: Geoffrey Thomas <geofft@ldpreload.com>
Signed-off-by: Geoffrey Thomas <geofft@ldpreload.com>
Co-developed-by: Finn Behrens <me@kloenk.de>
Signed-off-by: Finn Behrens <me@kloenk.de>
Co-developed-by: Adam Bratschi-Kaye <ark.email@gmail.com>
Signed-off-by: Adam Bratschi-Kaye <ark.email@gmail.com>
Co-developed-by: Wedson Almeida Filho <wedsonaf@google.com>
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
include/linux/kallsyms.h
kernel/livepatch/core.c
scripts/kallsyms.c
tools/include/linux/kallsyms.h
tools/include/linux/lockdep.h
tools/lib/perf/include/perf/event.h
tools/lib/symbol/kallsyms.h

index 465060acc9816f81a4dd3768924a0055b9b833be..5cdc6903abca3581474977c8de4965f86598bb01 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <asm/sections.h>
 
-#define KSYM_NAME_LEN 128
+#define KSYM_NAME_LEN 512
 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
                         2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
 
index 335d988bd811177a568a2edbaefea015061cec1d..73874e5edfda69c81c8833779c9f57f4f72553b9 100644 (file)
@@ -213,7 +213,7 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab,
         * we use the smallest/strictest upper bound possible (56, based on
         * the current definition of MODULE_NAME_LEN) to prevent overflows.
         */
-       BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 128);
+       BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 512);
 
        relas = (Elf_Rela *) relasec->sh_addr;
        /* For each rela in this klp relocation section */
@@ -227,7 +227,7 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab,
 
                /* Format: .klp.sym.sym_objname.sym_name,sympos */
                cnt = sscanf(strtab + sym->st_name,
-                            ".klp.sym.%55[^.].%127[^,],%lu",
+                            ".klp.sym.%55[^.].%511[^,],%lu",
                             sym_objname, sym_name, &sympos);
                if (cnt != 3) {
                        pr_err("symbol %s has an incorrectly formatted name\n",
index bcdabee13aab5f06d0ef9e67ff3c17951abd02a3..9bab5f55ade3d072dff0c3367fa7ccd497589e0c 100644 (file)
@@ -27,7 +27,7 @@
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 
-#define KSYM_NAME_LEN          128
+#define KSYM_NAME_LEN          512
 
 struct sym_entry {
        unsigned long long addr;
index efb6c3f5f2a9a53a58e436fe120dd7b4d9880d8a..5a37ccbec54fbc603108ad9346c0351c8a3c56a8 100644 (file)
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#define KSYM_NAME_LEN 128
+#define KSYM_NAME_LEN 512
 
 struct module;
 
index e56997288f2b07d273f860be50a830351ad128e1..d9c163f3ab242220f613a3ad20b264302a92bfed 100644 (file)
@@ -47,7 +47,7 @@ static inline int debug_locks_off(void)
 
 #define task_pid_nr(tsk) ((tsk)->pid)
 
-#define KSYM_NAME_LEN 128
+#define KSYM_NAME_LEN 512
 #define printk(...) dprintf(STDOUT_FILENO, __VA_ARGS__)
 #define pr_err(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
 #define pr_warn pr_err
index d82054225fcc0ee16e08329e14bbdf089e961802..f5c40325b4414ceb495818a78019a62595811afb 100644 (file)
@@ -93,7 +93,7 @@ struct perf_record_throttle {
 };
 
 #ifndef KSYM_NAME_LEN
-#define KSYM_NAME_LEN 256
+#define KSYM_NAME_LEN 512
 #endif
 
 struct perf_record_ksymbol {
index 72ab9870454baf15052fabb233ebcc04b27f94e3..542f9b059c3bd2502e8713fa995137e66b8503a5 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/types.h>
 
 #ifndef KSYM_NAME_LEN
-#define KSYM_NAME_LEN 256
+#define KSYM_NAME_LEN 512
 #endif
 
 static inline u8 kallsyms2elf_binding(char type)