Re: [PATCH 02/15] arm: __NR_syscalls fix

From: Miklos Szeredi
Date: Fri Apr 11 2014 - 08:02:43 EST


On Fri, Apr 11, 2014 at 1:54 PM, Russell King - ARM Linux
<linux@xxxxxxxxxxxxxxxx> wrote:
> On Fri, Apr 11, 2014 at 01:50:50PM +0200, Miklos Szeredi wrote:
>> On Fri, Apr 11, 2014 at 12:33 PM, Russell King - ARM Linux
>> <linux@xxxxxxxxxxxxxxxx> wrote:
>> > On Fri, Apr 11, 2014 at 12:25:38PM +0200, Miklos Szeredi wrote:
>> >> From: Miklos Szeredi <mszeredi@xxxxxxx>
>> >>
>> >> Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
>> >> Cc: Russell King <linux@xxxxxxxxxxxxxxxx>
>> >> ---
>> >
>> > This has me wondering...
>> >
>> > (a) what you think it fixes
>> > (b) whether you tried to build-test this
>> >
>> > The ARM instruction set supports 8-bit immediate constants with an even
>> > power of two shift. 384 fits that (0x180), 382 does not (0x17e), and
>> > in your following patch, 383 definitely doesn't (0x17f).
>> >
>> > Having this constant larger than necessary does not cause any problem
>> > for the syscall table: we explicitly pad it with calls to sys_ni_syscall
>> > to make up the difference.
>>
>> Yes, and the padding will be of wrong length if NR_syscalls is
>> incorrect (which may be Oopsable?). At least that is my impression
>> from a casual glance.
>
> Please explain.

Look at ending lines of arch/arm/kernel/calls.S: if NR_syscalls is a
multiple of 4, then syscalls_padding will be zero. I.e. no padding
despite the fact that there is in fact only 382 system calls in table
and there should be 2 sys_ni_syscall pads.

So there's some crap in there, for sure. If it causes actual
problems, I don't know.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/