Skip to contentSkip to conversation

SyS symbol munging.

DISCUSSION Dave Jones 6 participants 9 messages May 10, 2013

lore
Share & tools
lore

Dave Jones

author
#0 lore raw
Quoted 8 lines · Andrew Morton
[  163.953629] Call Trace:
[  163.957706]  [<ffffffff812be322>] ipcget+0x182/0x380
[  163.962123]  [<ffffffff810b99a5>] ?trace_hardirqs_on_caller+0x115/0x1e0
[  163.966752]  [<ffffffff812c559a>] SyS_shmget+0x5a/0x60
[  163.971163]  [<ffffffff812c47e0>] ? shm_close+0x140/0x140
[  163.975590]  [<ffffffff812c3e60>] ? shm_release+0x50/0x50
[  163.979991]  [<ffffffff812c3df0>] ? shm_get_unmapped_area+0x20/0x20
[  163.984499]  [<ffffffff816caa14>] tracesys+0xdd/0xe2

This has been bugging me for a while.
What's changing sys_shmget to SyS_shmget in that trace ? And why ?

Dave

#1 lore raw
Quoted 11 lines · Dave Jones
Quoted 8 lines · Andrew Morton
[  163.953629] Call Trace:
[  163.957706]  [<ffffffff812be322>] ipcget+0x182/0x380
[  163.962123]  [<ffffffff810b99a5>] ?trace_hardirqs_on_caller+0x115/0x1e0
[  163.966752]  [<ffffffff812c559a>] SyS_shmget+0x5a/0x60
[  163.971163]  [<ffffffff812c47e0>] ? shm_close+0x140/0x140
[  163.975590]  [<ffffffff812c3e60>] ? shm_release+0x50/0x50
[  163.979991]  [<ffffffff812c3df0>] ? shm_get_unmapped_area+0x20/0x20
[  163.984499]  [<ffffffff816caa14>] tracesys+0xdd/0xe2
Quoted 2 lines

This has been bugging me for a while.
What's changing sys_shmget to SyS_shmget in that trace ? And why ?

+1.

And not only sys_shmget:

SyS_access
SyS_chdir
SyS_chown
SyS_fchownat
SyS_flock
SyS_mkdir
SyS_mkdirat
SyS_mknod
SyS_mknodat
SyS_mount

I have those in backtraces from my boot logs of randconfig kernels in the last couple of days.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#2 lore raw
In reply to Dave Jones
Quoted 11 lines · On Fri, 10 May 2013 15:24:17 -0400 Dave Jones <[email protected]> wrote:
Quoted 8 lines · Andrew Morton
[  163.953629] Call Trace:
[  163.957706]  [<ffffffff812be322>] ipcget+0x182/0x380
[  163.962123]  [<ffffffff810b99a5>] ?trace_hardirqs_on_caller+0x115/0x1e0
[  163.966752]  [<ffffffff812c559a>] SyS_shmget+0x5a/0x60
[  163.971163]  [<ffffffff812c47e0>] ? shm_close+0x140/0x140
[  163.975590]  [<ffffffff812c3e60>] ? shm_release+0x50/0x50
[  163.979991]  [<ffffffff812c3df0>] ? shm_get_unmapped_area+0x20/0x20
[  163.984499]  [<ffffffff816caa14>] tracesys+0xdd/0xe2
Quoted 3 lines

This has been bugging me for a while.
What's changing sys_shmget to SyS_shmget in that trace ? And why ?

nm vmlinux | grep SyS

That's the actual name of the function definition which the C compiler sees. It's emitted by SYSCALL_DEFINE, cooked up by all the macro goop in include/linux/syscalls.h.

I forget who did this initially and peeling back those layers with git is tiresome.

#3 lore raw
Quoted 19 lines · Andrew Morton
Quoted 11 lines · On Fri, 10 May 2013 15:24:17 -0400 Dave Jones <[email protected]> wrote:
Quoted 8 lines · Andrew Morton
[  163.953629] Call Trace:
[  163.957706]  [<ffffffff812be322>] ipcget+0x182/0x380
[  163.962123]  [<ffffffff810b99a5>] ?trace_hardirqs_on_caller+0x115/0x1e0
[  163.966752]  [<ffffffff812c559a>] SyS_shmget+0x5a/0x60
[  163.971163]  [<ffffffff812c47e0>] ? shm_close+0x140/0x140
[  163.975590]  [<ffffffff812c3e60>] ? shm_release+0x50/0x50
[  163.979991]  [<ffffffff812c3df0>] ? shm_get_unmapped_area+0x20/0x20
[  163.984499]  [<ffffffff816caa14>] tracesys+0xdd/0xe2
Quoted 3 lines

This has been bugging me for a while.
What's changing sys_shmget to SyS_shmget in that trace ? And why ?

nm vmlinux | grep SyS

Quoted 7 lines

That's the actual name of the function definition which the C compiler sees. It's emitted by SYSCALL_DEFINE, cooked up by all the macro goop in include/linux/syscalls.h.

I forget who did this initially and peeling back those layers with git is tiresome.
--

$ git blame include/linux/syscalls.h | grep SyS | more
07fe6e00 (Al Viro                  2013-01-21 15:03:44 -0500 189) 	asmlinka
ge long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))	\
6c597963 (Heiko Carstens           2009-02-11 13:04:38 -0800 196) 	SYSCALL_
ALIAS(sys##name, SyS##name);

Those 2 commits explain (to some degree) what the patches do, but not why "SyS".

Signature · 1 line
~Randy
#4 lore raw
In reply to Andrew Morton
Quoted 2 lines · Andrew Morton

I forget who did this initially and peeling back those layers with git is tiresome.

1a94bc34768e4 from 2009, although those SyS* things started appearing in stack traces only recently AFAIR.

Hmm.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#5 lore raw
Quoted 6 lines · Borislav Petkov
Quoted 2 lines · Andrew Morton

I forget who did this initially and peeling back those layers with git is tiresome.

1a94bc34768e4 from 2009, although those SyS* things started appearing in stack traces only recently AFAIR.

Note that both sys_something and SyS_something end up in vmlinux symbol table, refering to the same address. AFAICS, what matters is which one goes first. May be even linker-dependent...

#6 lore raw
Quoted 3 lines · Al Viro

Note that both sys_something and SyS_something end up in vmlinux symbol table, refering to the same address. AFAICS, what matters is which one goes first. May be even linker-dependent...

Interesting.

So it could be that a change in the linker may have caused the SyS things to go first and start appearing in stack traces, not necessarily a change in the kernel...

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#7 lore raw
In reply to Al Viro
Quoted 11 lines · Al Viro
Quoted 6 lines · Borislav Petkov
Quoted 2 lines · Andrew Morton

I forget who did this initially and peeling back those layers with git is tiresome.

1a94bc34768e4 from 2009, although those SyS* things started appearing in stack traces only recently AFAIR.

Note that both sys_something and SyS_something end up in vmlinux symbol table, refering to the same address. AFAICS, what matters is which one goes first. May be even linker-dependent...

Actually, it's the first one that kallsyms finds in its binary search.

If the table is layed out a little differently, it may find the first one or the second one.

-- Steve

#8 lore raw
Quoted 9 lines · Steven Rostedt
Quoted 8 lines · Al Viro
Quoted 6 lines · Borislav Petkov
Quoted 2 lines · Andrew Morton

I forget who did this initially and peeling back those layers with git is tiresome.

1a94bc34768e4 from 2009, although those SyS* things started appearing in stack traces only recently AFAIR.

Quoted 8 lines
Quoted 3 lines

Note that both sys_something and SyS_something end up in vmlinux symbol table, refering to the same address. AFAICS, what matters is which one goes first. May be even linker-dependent...

Actually, it's the first one that kallsyms finds in its binary search.

If the table is layed out a little differently, it may find the first one or the second one.

Then maybe it's worth trying to kill these aliases in kallsyms. We also have compat_SyS_something stuff. Actually, most of the aliases seem to be of those forms - after removing (a_sys_b,a_SyS_b) pairs the list of duplicates in System.map shrinks by factor of 15 or so...