Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp737438imu; Tue, 27 Nov 2018 05:40:33 -0800 (PST) X-Google-Smtp-Source: AJdET5cxAxdcrdikEjwJPPetB2eRcoOFDuaJgY7ANFG5c5Hteu9eit4cP4HY+TQ3Oao8lchlMvj4 X-Received: by 2002:a62:670f:: with SMTP id b15mr32826845pfc.212.1543326033851; Tue, 27 Nov 2018 05:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543326033; cv=none; d=google.com; s=arc-20160816; b=vU9D7CNrJOVmpApYc5SIBhFGaf6zb6QEUCz7dJBdouiBGH5ktq5mh7K99YGqFM0Wqt gkievexfCoAXYvWV0IgzAIDVkNCROerL6uXndlyy4Cx/pBxRlbMikSSVHaAo7vKZ1gYe T6BRfFa202Pop7XvusCuTRe/fLNih515x9oxZ4FIip3fwQYXUUShMUqXyuoC+UnzUCiQ kxLIAeRjhREUQOoRxLJf7KUkuSuRkdTBIp98xwuzPZCOgAyjJ4yHUG8jQLavRNXK+tCh ILbids6I1w7HUJIegKVSSJb1a2Ve4c0fdErnRKGVjhcesgdUDGdybySQ5nrgod356T9p S86w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=p/8zkh26w3u34xkCMiwFd4gZz4U9X/ULJqb3KHLd/bQ=; b=WWD7GeY4+7K6jaJYwWXf7YriaFTpoGAPCsiVaAw1fCX/rEn/R0qv0mmFFT4J527u8M yv//nnQ6xUvoCTitVbSnDhgRqCzGaE7YEuTjgAV9WiyLiVWyoocHQSRXNFr01YlKmlUz 5YvB53rgY67U8vyibwiWQY0uhPsdOatJC4oxMEluYrgA19LSmDdkmRevkehURskSglZw kVXP4SffLYvM2T4B4IzcaFLj3BKD1DR+naPr3QpBLTxedyTrhoiuEQl1Q+FHyV2csufp IqEqJwW2e1BUAahmv1z8wSglBUr4hewu6qcL1EjdugRMyLxj33kSR2e6WAruyUj3coWZ 790Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si3939962plo.202.2018.11.27.05.40.15; Tue, 27 Nov 2018 05:40:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728695AbeK0X3Y (ORCPT + 99 others); Tue, 27 Nov 2018 18:29:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34952 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726544AbeK0X3Y (ORCPT ); Tue, 27 Nov 2018 18:29:24 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 783A1307EAA6; Tue, 27 Nov 2018 12:31:37 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.12]) by smtp.corp.redhat.com (Postfix) with SMTP id 35A4F105B1E8; Tue, 27 Nov 2018 12:31:18 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 27 Nov 2018 13:31:37 +0100 (CET) Date: Tue, 27 Nov 2018 13:31:17 +0100 From: Oleg Nesterov To: Elvira Khabirova Cc: rostedt@goodmis.org, mingo@redhat.com, linux-kernel@vger.kernel.org, ldv@altlinux.org, esyr@redhat.com, luto@kernel.org, strace-devel@lists.strace.io, linux-api@vger.kernel.org Subject: Re: [RFC PATCH RESEND v3 3/3] ptrace: add PTRACE_EVENT_SECCOMP support to PTRACE_GET_SYSCALL_INFO Message-ID: <20181127123116.GA13284@redhat.com> References: <20181125022150.46258a20@akathisia> <20181125022340.5703400f@akathisia> <20181126143524.GB1660@redhat.com> <20181127040732.1c9f7965@akathisia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181127040732.1c9f7965@akathisia> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 27 Nov 2018 12:31:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Just like ptrace_request(PTRACE_LISTEN) does but you can do this lockless (no need to lock_task_sighand()). 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? Oleg.