From: Thomas Gleixner <tglx@linutronix.de>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 6/6] x86/syscall: use int everywhere for system call numbers
Date: Thu, 20 May 2021 10:53:21 +0200 [thread overview]
Message-ID: <87zgwpbxby.ffs@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20210518191303.4135296-7-hpa@zytor.com>
On Tue, May 18 2021 at 12:13, H. Peter Anvin wrote:
> +static __always_inline bool do_syscall_x64(struct pt_regs *regs, int nr)
> +{
> + /*
> + * Convert negative numbers to very high and thus out of range
> + * numbers for comparisons. Use unsigned long to slightly
> + * improve the array_index_nospec() generated code.
How is that actually improving the generated code?
unsigned long:
104: 48 81 fa bf 01 00 00 cmp $0x1bf,%rdx
10b: 48 19 c0 sbb %rax,%rax
10e: 48 21 c2 and %rax,%rdx
111: 48 89 df mov %rbx,%rdi
114: 48 8b 04 d5 00 00 00 mov 0x0(,%rdx,8),%rax
11b: 00
11c: e8 00 00 00 00 callq 121 <do_syscall_64+0x41>
unsigned int:
f1: 48 81 fa bf 01 00 00 cmp $0x1bf,%rdx
f8: 48 19 d2 sbb %rdx,%rdx
fb: 21 d0 and %edx,%eax
fd: 48 89 df mov %rbx,%rdi
100: 48 8b 04 c5 00 00 00 mov 0x0(,%rax,8),%rax
107: 00
108: e8 00 00 00 00 callq 10d <do_syscall_64+0x3d>
Text size increases with that unsigned long cast.
I must be missing something.
Thanks,
tglx
next prev parent reply other threads:[~2021-05-20 8:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 19:12 [PATCH v4 0/6] x86/syscall: use int for x86-64 system calls H. Peter Anvin
2021-05-18 19:12 ` [PATCH v4 1/6] x86/syscall: update and extend selftest syscall_numbering_64 H. Peter Anvin
2021-05-20 13:23 ` [tip: x86/entry] selftests/x86/syscall: Update and extend syscall_numbering_64 tip-bot2 for H. Peter Anvin (Intel)
2021-05-18 19:12 ` [PATCH v4 2/6] x86/syscall: simplify message reporting in syscall_numbering.c H. Peter Anvin
2021-05-20 13:23 ` [tip: x86/entry] selftests/x86/syscall: Simplify message reporting in syscall_numbering tip-bot2 for H. Peter Anvin (Intel)
2021-05-18 19:13 ` [PATCH v4 3/6] x86/syscall: add tests under ptrace to syscall_numbering.c H. Peter Anvin
2021-05-20 13:23 ` [tip: x86/entry] selftests/x86/syscall: Add tests under ptrace to syscall_numbering_64 tip-bot2 for H. Peter Anvin (Intel)
2021-05-18 19:13 ` [PATCH v4 4/6] x86/syscall: sign-extend system calls on entry to int H. Peter Anvin
2021-05-20 13:23 ` [tip: x86/entry] x86/entry/64: Sign-extend " tip-bot2 for H. Peter Anvin (Intel)
2021-05-18 19:13 ` [PATCH v4 5/6] x86/syscall: treat out of range and gap system calls the same H. Peter Anvin
2021-05-20 13:23 ` [tip: x86/entry] x86/entry: Treat " tip-bot2 for H. Peter Anvin (Intel)
2021-05-18 19:13 ` [PATCH v4 6/6] x86/syscall: use int everywhere for system call numbers H. Peter Anvin
2021-05-20 8:53 ` Thomas Gleixner [this message]
2021-05-21 21:36 ` H. Peter Anvin
2021-05-22 13:19 ` David Laight
2021-05-25 8:13 ` [tip: x86/entry] x86/entry: Use " tip-bot2 for H. Peter Anvin (Intel)
2021-05-19 11:29 ` [PATCH v4 0/6] x86/syscall: use int for x86-64 system calls Ingo Molnar
2021-05-19 16:17 ` 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=87zgwpbxby.ffs@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
/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