Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1436573
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] Syscall arguments are unsigned long (full registers) |
| Date | 2016-07-04 17:00 +0200 |
| Message-ID | <rRdvQ-6Up-11@gated-at.bofh.it> (permalink) |
| References | <rRczL-6hG-9@gated-at.bofh.it> <rRd2N-6Kd-13@gated-at.bofh.it> <rRdm9-6R8-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Monday, July 4, 2016 2:47:10 PM CEST Tautschnig, Michael wrote:
> Thanks a lot for the immediate feedback.
>
> > On 4 Jul 2016, at 16:28, Andi Kleen <ak@linux.intel.com> wrote:
> >
> > On Mon, Jul 04, 2016 at 01:52:58PM +0000, Tautschnig, Michael wrote:
> >> All syscall arguments are passed in as types of the same byte size as
> >> unsigned long (width of full registers). Using a smaller type without a
> >> cast may result in losing bits of information. In all other instances
> >> apart from the ones fixed by the patch the code explicitly introduces
> >> type casts (using, e.g., SYSCALL_DEFINE1).
> >>
> >> While goto-cc reported these problems at build time, it is noteworthy
> >> that the calling conventions specified in the System V AMD64 ABI do
> >> ensure that parameters 1-6 are passed via registers, thus there is no
> >> implied risk of misaligned stack access.
> >
> > Does this actually fix anything?
> >
>
> It will ensure the behaviour on 32 and 64-bit systems is consistent, i.e.,
> no truncation occurs. This is to ensure that future uses of these syscalls
> do not face surprises.
>
>
It looks to me like you are introducing a truncation, not removing
one as your comment suggests:
long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
-long sys_arch_prctl(int code, unsigned long addr)
+long sys_arch_prctl(unsigned long code, unsigned long addr)
{
return do_arch_prctl(current, code, addr);
}
This is the same truncation that we do with SYSCALL_DEFINE2(),
clearing the top 32 bits of the 'code' parameter to ensure that
user space doesn't pass data unexpectedly.
That change seems reasonable, but why not just use SYSCALL_DEFINE2()
directly for consistency with the other syscalls?
Arnd
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] Syscall arguments are unsigned long (full registers) "Tautschnig, Michael" <tautschn@amazon.co.uk> - 2016-07-04 16:00 +0200
Re: [PATCH] Syscall arguments are unsigned long (full registers) Andi Kleen <ak@linux.intel.com> - 2016-07-04 16:30 +0200
Re: [PATCH] Syscall arguments are unsigned long (full registers) "Tautschnig, Michael" <tautschn@amazon.co.uk> - 2016-07-04 16:50 +0200
Re: [PATCH] Syscall arguments are unsigned long (full registers) Arnd Bergmann <arnd@arndb.de> - 2016-07-04 17:00 +0200
csiph-web