Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1296179

Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs

From Mickaël Salaün <mic@digikod.net>
Newsgroups linux.kernel
Subject Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs
Date 2015-12-21 21:00 +0100
Message-ID <qIeMG-2kK-3@gated-at.bofh.it> (permalink)
References (2 earlier) <qHWwp-7K0-1@gated-at.bofh.it> <qI4tX-4fy-3@gated-at.bofh.it> <qI4DD-4y3-5@gated-at.bofh.it> <qI4WZ-4EK-9@gated-at.bofh.it> <qI5Jo-5ac-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 21/12/2015 11:13, Richard Weinberger wrote:
> Am 21.12.2015 um 10:23 schrieb Mickaël Salaün:
>>>>> Doesn't this break the support for changing syscall numbers using PTRACE_SETREGS?
>>>>
>>>> The logic is unchanged except updating the UPT_SYSCALL_NR before syscall_trace_enter(). I did my last tests with the x86_32 subarchitecture and all tests (from selftest/seccomp), including PTRACE_SETREGS for syscall numbers tests, passed. However, 2 of this tests still fail for x86_64 (only).
>>>
>>> No, the logic is different.
>>> syscall_trace_enter(regs) enters the ptrace() path and here registers can be changed.
>>> Hence "syscall = UPT_SYSCALL_NR(r);" will see the old syscall number.
>>> UPT_SYSCALL_NR() returns the syscall number before the ptrace() path...
>>
>> The thing is, PTRACE_SETREGS give access to *orig_ax* in the user_regs_struct from arch/x86/include/asm/user_*.h and selftest/seccomp only update this (virtual) register, not the EAX/RAX. Am I missing something?
> 
> Sorry, meant orig...
> 
> Please see the attached program. It proves that your patch is breaking stuff.
> The test is extracted from UML's selftests.

OK, I found the origin of this misunderstanding. On x86_32, PTRACE_SETREGS set regs->syscall when updating orig_eax, which is not the case on x86_64, hence the difference of behavior. I fixed this bug in the v2 series. The ptsc test and all the seccomp tests pass for 32 and 64 bits!

Where can we find the UML selftests?

Thanks,
 Mickaël

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 0/4] um: Add seccomp support Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:10 +0100
  [PATCH v1 4/4] um: Add seccomp support Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:20 +0100
  [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:20 +0100
    Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 01:30 +0100
      Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 10:00 +0100
      Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 10:10 +0100
        Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 10:30 +0100
          Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Richard Weinberger <richard@nod.at> - 2015-12-21 11:20 +0100
            Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 21:00 +0100
      Re: [PATCH v1 1/4] um: Fix ptrace GETREGS/SETREGS bugs Mickaël Salaün <mic@digikod.net> - 2015-12-21 10:20 +0100
  [PATCH v1 2/4] selftests/seccomp: Remove the need for HAVE_ARCH_TRACEHOOK Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:30 +0100
  [PATCH v1 3/4] um: Add full asm/syscall.h support Mickaël Salaün <mic@digikod.net> - 2015-12-21 01:30 +0100

csiph-web