Skip to content

Commit 4296f07

Browse files
committed
RFC: kallsyms: Add a selftest for longest symbol name support
Signed-off-by: Boqun Feng <[email protected]>
1 parent d895436 commit 4296f07

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

kernel/kallsyms.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,22 @@ static const struct proc_ops kallsyms_proc_ops = {
865865
.proc_release = seq_release_private,
866866
};
867867

868+
#define DI(name) n##name##name
869+
#define DDI(name) DI(n##name##name)
870+
#define DDDI(name) DDI(n##name##name)
871+
#define DDDDI(name) DDDI(n##name##name)
872+
#define DDDDDI(name) DDDDI(n##name##name)
873+
874+
/* Generate a symbol whose name length is 511 */
875+
#define LONGEST_NAME DDDDDI(g1h2i3j4k5l6m7n)
876+
877+
extern int LONGEST_NAME(void) { return 0; }
878+
868879
static int __init kallsyms_init(void)
869880
{
881+
/* Showing that the longest name is supported */
882+
BUG_ON(!kallsyms_lookup_name(__stringify(LONGEST_NAME)));
883+
870884
proc_create("kallsyms", 0444, NULL, &kallsyms_proc_ops);
871885
return 0;
872886
}

0 commit comments

Comments
 (0)