Re: [PATCH v3 2/4] x86/syscall: update and extend selftest syscall_numbering_64

From: H. Peter Anvin
Date: Tue May 18 2021 - 11:04:56 EST


Well, I finished the ptracer addition to the test. It was *interesting*: it turns out that ptracing system calls, *even without modifying the state in any way*, just being a passive observer, a sign-extends the system call numbers *on current kernels*.

This means that on current kernels passively tracing a process changes the syscall behavior. I think we can all agree that that is not acceptable.

I will do a couple of cleanups and add this to a v4 patchset.

On May 16, 2021 12:52:06 AM PDT, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
>* H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>
>> From: "H. Peter Anvin (Intel)" <hpa@xxxxxxxxx>
>>
>> Update the syscall_numbering_64 selftest to reflect that a system
>call
>> is to be extended from 32 bits. Add a mix of tests for valid and
>> invalid system calls in 64-bit and x32 space.
>>
>> Use an explicit system call instruction, because we cannot know if
>the
>> glibc syscall() wrapper intercepts instructions, extends the system
>> call number independently, or anything similar.
>>
>> Use long long instead of long to make it possible to compile this
>test
>> on x32 as well as 64 bits.
>>
>> Signed-off-by: H. Peter Anvin (Intel) <hpa@xxxxxxxxx>
>> ---
>> .../testing/selftests/x86/syscall_numbering.c | 274
>++++++++++++++----
>> 1 file changed, 222 insertions(+), 52 deletions(-)
>
>Small request: I'd suggest moving this to the first place - so that we
>can
>easily test before/after effects of (current) patch #1/4.
>
>Thanks,
>
> Ingo

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.