lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181127232753.GA18755@altlinux.org>
Date:   Wed, 28 Nov 2018 02:27:53 +0300
From:   "Dmitry V. Levin" <ldv@...linux.org>
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     Elvira Khabirova <lineprinter@...linux.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>,
        Eugene Syromyatnikov <esyr@...hat.com>,
        Andy Lutomirski <luto@...nel.org>,
        strace-devel@...ts.strace.io, linux-api@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH RESEND v3 3/3] ptrace: add PTRACE_EVENT_SECCOMP
 support to PTRACE_GET_SYSCALL_INFO

On Tue, Nov 27, 2018 at 01:31:17PM +0100, Oleg Nesterov wrote:
> On 11/27, Elvira Khabirova wrote:
> > On Mon, 26 Nov 2018 15:35:24 +0100, Oleg Nesterov wrote:
> > > On 11/25, Elvira Khabirova wrote:
> > > >
> > > > Extend PTRACE_GET_SYSCALL_INFO to support PTRACE_EVENT_SECCOMP stops.
> > > > The information returned is the same as for syscall-enter-stops.
> > >
> > > Oh, this is not nice ;) there must be a better option, I hope... Plus
> > >
> > >
> > > Can't ptrace_get_syscall() check
> > >
> > > 	child->exit_code == (PTRACE_EVENT_SECCOMP << 8) | SIGTRAP;
> > >
> > > to detect the PTRACE_EVENT_SECCOMP case?
> >
> > Nope; looks like exit_code is zeroed after wait().
> 
> Yes, thanks for correcting me,
> 
> but we can use child->last_siginfo->si_code.

Yes, this approach works, thanks!

> Just like ptrace_request(PTRACE_LISTEN)
> does but you can do this lockless (no need to lock_task_sighand()).

Why this can be done lockless?  All other places in that file do
the locking, so I'd rather add a comment in the new code.

> And if we require that the user of ptrace_get_syscall() should also use TRACESYSGOOD
> then ptrace_get_syscall() can probably do something like
> 
> 	int entry;
> 
> 	if (!child->last_siginfo)
> 		return -EINVAL;
> 	else if (child->last_siginfo->si_code == (PTRACE_EVENT_SECCOMP << 8) | SIGTRAP)
> 		entry = 1;
> 	else if (child->last_siginfo->si_code == SIGTRAP | 0x80)
> 		entry = child->ptrace_message == PTRACE_EVENTMSG_SYSCALL_ENTRY;
> 	else
> 		return -EINVAL;
> 
> and this way PTRACE_EVENTMSG_SYSCALL_ENTRY/EXIT can't confict with seccomp or
> anything else.
> 
> No?
> 
> Of course, debugger can do PTRACE_SETSIGINFO and confuse itself but probably we
> do not care?

The only potential issue I could think of is whether PTRACE_SETSIGINFO
could be used this way to cause an information leak by making
PTRACE_GET_SYSCALL_INFO access some unrelated data.


-- 
ldv

Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ