From: "Tautschnig, Michael" <tautschn-vV1OtcyAfmbQXOPxS62xeg@public.gmane.org>
To: Andi Kleen <ak-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: "x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Jaswinder Singh
<jaswinder-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Subject: Re: [PATCH] Syscall arguments are unsigned long (full registers)
Date: Mon, 4 Jul 2016 14:47:10 +0000 [thread overview]
Message-ID: <ED0D99E6-1A18-4263-B227-7105313FA6AC@amazon.com> (raw)
In-Reply-To: <20160704142802.GL25121-KWJ+5VKanrL29G5dvP0v1laTQe2KTcn/@public.gmane.org>
Thanks a lot for the immediate feedback.
> On 4 Jul 2016, at 16:28, Andi Kleen <ak-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> 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 seems a big dangerous to me, potentially breaking some existing
> binaries that rely on these arguments being truncated.
>
Would an analysis of all current call sites be of help? It seems impossible
to tell whether any modules outside the kernel tree using this functionality
rely on the (seemingly broken) behaviour.
Of course I could also provide a patch that introduces explicit type casts
to document the truncation.
Best,
Michael
next prev parent reply other threads:[~2016-07-04 14:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 13:52 [PATCH] Syscall arguments are unsigned long (full registers) Tautschnig, Michael
[not found] ` <A9946D15-1553-417B-BD0C-6C65AA2122B3-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2016-07-04 14:28 ` Andi Kleen
[not found] ` <20160704142802.GL25121-KWJ+5VKanrL29G5dvP0v1laTQe2KTcn/@public.gmane.org>
2016-07-04 14:47 ` Tautschnig, Michael [this message]
[not found] ` <ED0D99E6-1A18-4263-B227-7105313FA6AC-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2016-07-04 14:59 ` Arnd Bergmann
2016-07-04 15:13 ` Tautschnig, Michael
2016-07-04 18:27 ` H. Peter Anvin
[not found] ` <C22BF648-D579-4B23-8BF6-C18033433F22-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2016-07-04 20:13 ` Tautschnig, Michael
[not found] ` <C9F705AD-41A0-48CF-8A3E-507C12EB5D0E-vV1OtcyAfmbQT0dZR+AlfA@public.gmane.org>
2016-07-04 20:23 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ED0D99E6-1A18-4263-B227-7105313FA6AC@amazon.com \
--to=tautschn-vv1otcyafmbqxopxs62xeg@public.gmane.org \
--cc=ak-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=jaswinder-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox