From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7F78371CF3 for ; Mon, 23 Mar 2026 12:09:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774267792; cv=none; b=V75EUHunFHTpj8fHr0SVN0WDrXqn39baKVoc3/vbaooYdAGtIP4enkP2WSE637mdnnbsR9Naekb2ZN5A0Ur//uOeEkpUv2EkUDwfyBLWEQeDXlv9g1FMBAGYEbJz5W2UR0jWOH4Esrt2DvRkTtG732G9aLzImRryC5EhgLviazg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774267792; c=relaxed/simple; bh=hfsah6RtZ+rv9jivaSOoXJqo9dfGaRh3t1/HCRwN9PA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SBZSdWV3iOqlIRUflN3o1bS6aNCf01DQPOTI/d/D2U0xhlCBijDQJhDz0HAEUzrpkES9NhOjAhEM47T78PAKow0V40jqsAoSlTET1SZX7FT1F3rmqkODutBoNc0mP6BckqC0Ch4V7ujn36KgI8jqvcLFabintteabf9yATqg0Mw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bXzVsIMI; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bXzVsIMI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774267789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=X2xmHyFrMjAN8rDtuYTHwOlcH6vP7Momep3HxgNYYTY=; b=bXzVsIMIyMmrm3GgndhJ8xB1G77nCOzswdKW8X7A/IaSOwHkcHakjiL8Ebt/lDgARf1W5t zeO6wv0Ux4NdCadfuo8FMnB9OBwNEJppSH/3I/bv8CBgLGb4IPWcOBzr8BgGQtCXSVAE5G fi3vFQiDzbD1/fheJrwqbFNl+ajSWf4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-EQIYJZwgPEKi8yBESizjfw-1; Mon, 23 Mar 2026 08:09:46 -0400 X-MC-Unique: EQIYJZwgPEKi8yBESizjfw-1 X-Mimecast-MFC-AGG-ID: EQIYJZwgPEKi8yBESizjfw_1774267784 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3875C18005B8; Mon, 23 Mar 2026 12:09:44 +0000 (UTC) Received: from fedora (unknown [10.44.32.25]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 9488B1800351; Mon, 23 Mar 2026 12:09:39 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 23 Mar 2026 13:09:43 +0100 (CET) Date: Mon, 23 Mar 2026 13:09:38 +0100 From: Oleg Nesterov To: Kees Cook Cc: Andrew Morton , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Will Drewry , Max Ver , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] ptrace: don't report syscall-exit if the tracee was killed by seccomp Message-ID: References: <6E69C3F0-0691-4115-AE36-F5E5743C942A@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On 03/22, Oleg Nesterov wrote: > > On 03/22, Kees Cook wrote: > > > > Hmm. I'm still not convinced this is right, > > Me too actually ;) > > That is why RFC. So: > > - Do you agree that the current behaviour is not really "sane" and > can confuse ptracers? > > - If yes, what else do you think we can do? No, I no longer think it > makes sense to change the ptrace_get_syscall_info_exit() paths... Perhaps _something_ like the change below makes more sense? Oleg. --- x/kernel/seccomp.c +++ x/kernel/seccomp.c @@ -1357,8 +1357,8 @@ static int __seccomp_filter(int this_sys /* Dump core only if this is the last remaining thread. */ if (action != SECCOMP_RET_KILL_THREAD || (atomic_read(¤t->signal->live) == 1)) { - /* Show the original registers in the dump. */ - syscall_rollback(current, current_pt_regs()); + syscall_set_return_value(current, current_pt_regs(), + -EINTR, 0); /* Trigger a coredump with SIGSYS */ force_sig_seccomp(this_syscall, data, true); } else { --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2916,6 +2916,11 @@ bool get_signal(struct ksignal *ksig) if (!signr) break; /* will return 0 */ + + // incomplete and ugly, just for illustration + if (ksig->info.si_code == SYS_SECCOMP) + syscall_rollback(current, current_pt_regs()); + if (unlikely(current->ptrace) && (signr != SIGKILL) && !(sighand->action[signr -1].sa.sa_flags & SA_IMMUTABLE)) { signr = ptrace_signal(signr, &ksig->info, type);