2013-05-10 19:24:22

by Dave Jones

[permalink] [raw]
Subject: SyS symbol munging.

On Fri, May 10, 2013 at 12:14:54PM -0700, Andrew Morton wrote:

> [ 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


2013-05-10 19:33:07

by Borislav Petkov

[permalink] [raw]
Subject: Re: SyS symbol munging.

On Fri, May 10, 2013 at 03:24:17PM -0400, Dave Jones wrote:
> On Fri, May 10, 2013 at 12:14:54PM -0700, Andrew Morton wrote:
>
> > [ 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 ?

+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.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

2013-05-10 19:35:17

by Andrew Morton

[permalink] [raw]
Subject: Re: SyS symbol munging.

On Fri, 10 May 2013 15:24:17 -0400 Dave Jones <[email protected]> wrote:

> On Fri, May 10, 2013 at 12:14:54PM -0700, Andrew Morton wrote:
>
> > [ 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 ?
>

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.

2013-05-10 19:46:12

by Randy Dunlap

[permalink] [raw]
Subject: Re: SyS symbol munging.

On 05/10/13 12:35, Andrew Morton wrote:
> On Fri, 10 May 2013 15:24:17 -0400 Dave Jones <[email protected]> wrote:
>
>> On Fri, May 10, 2013 at 12:14:54PM -0700, Andrew Morton wrote:
>>
>> > [ 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 ?
>>
>
> 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.
> --

$ 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".


--
~Randy

2013-05-10 19:47:21

by Borislav Petkov

[permalink] [raw]
Subject: Re: SyS symbol munging.

On Fri, May 10, 2013 at 12:35:10PM -0700, Andrew Morton wrote:
> 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.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

2013-05-10 20:05:11

by Al Viro

[permalink] [raw]
Subject: Re: SyS symbol munging.

On Fri, May 10, 2013 at 09:55:00PM +0200, Borislav Petkov wrote:
> On Fri, May 10, 2013 at 12:35:10PM -0700, Andrew Morton wrote:
> > 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...

2013-05-10 20:09:57

by Borislav Petkov

[permalink] [raw]
Subject: Re: SyS symbol munging.

On Fri, May 10, 2013 at 09:05:03PM +0100, Al Viro wrote:
> 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...

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

2013-05-10 20:56:27

by Steven Rostedt

[permalink] [raw]
Subject: Re: SyS symbol munging.

On Fri, May 10, 2013 at 09:05:03PM +0100, Al Viro wrote:
> On Fri, May 10, 2013 at 09:55:00PM +0200, Borislav Petkov wrote:
> > On Fri, May 10, 2013 at 12:35:10PM -0700, Andrew Morton wrote:
> > > 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

2013-05-10 21:17:25

by Al Viro

[permalink] [raw]
Subject: Re: SyS symbol munging.

On Fri, May 10, 2013 at 04:56:22PM -0400, Steven Rostedt wrote:
> On Fri, May 10, 2013 at 09:05:03PM +0100, Al Viro wrote:
> > On Fri, May 10, 2013 at 09:55:00PM +0200, Borislav Petkov wrote:
> > > On Fri, May 10, 2013 at 12:35:10PM -0700, Andrew Morton wrote:
> > > > 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.

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...