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.129.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 1C7D81C6FF5 for ; Thu, 16 Apr 2026 14:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776348462; cv=none; b=JRnZVsPSozZfrN7RX46+srz9VTnaftaM+k6kj4v/6W1FP+VR510o0zPeH0SEVQabAWUqjnxiOwSP9g9Bh6JZxOhwJuLvyjd+N9PaFDZ3gLkX7lEqr6rva1cEPn0rlpc+q3goiEVp/mdfKwRyPzJuU/E5yclcG2q/6C2D/k1zFws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776348462; c=relaxed/simple; bh=2+HLE0m8Gm6ftwnetiPp5/Eu1RdJZymIL0LVK/sg67c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EvhWDHXz0n+lqjLwBocTpV6gRuw7O9EPXhvnPIt5BXTOM4k47nmzglrdzfNEx25TUH9lBm0Rv+QzB2cFu5Smzs1pd30E2+jKCeXgVSveLqg8nXI/72075JOIdxaXvuG8juLcWR85PFVSB07RxcPrfi4nHa3KF11AvN5i2VBryv0= 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=AcwgUcGg; arc=none smtp.client-ip=170.10.129.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="AcwgUcGg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776348460; 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=Pmy/JBz5GRRG+7sB+rKftU2hKKD5hvP/hp4Rg/qIrD4=; b=AcwgUcGgOfdI8GfLE4JGCW6monosT8LnQtmNi2gbLdKZnkf919U/Ik0/gHE0Dz/is3ir3D R+RS6f6AfR/Id9dIw/3J13yjp5Z/+CO9z7MLrSTpjlENBhFGRZMBg3Qk0hn7l4EeOv6YW6 5QWD0k+Eu9V6QKROubNBzzkbnrKtTf4= 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-177-mQMzCyK_PPe2ZHnar4ohgw-1; Thu, 16 Apr 2026 10:07:33 -0400 X-MC-Unique: mQMzCyK_PPe2ZHnar4ohgw-1 X-Mimecast-MFC-AGG-ID: mQMzCyK_PPe2ZHnar4ohgw_1776348452 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 A8B1C1800282; Thu, 16 Apr 2026 14:07:31 +0000 (UTC) Received: from fedora (unknown [10.44.48.62]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 927DD30001A4; Thu, 16 Apr 2026 14:07:28 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 16 Apr 2026 16:07:31 +0200 (CEST) Date: Thu, 16 Apr 2026 16:07:26 +0200 From: Oleg Nesterov To: Kees Cook Cc: Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Will Drewry , Kusaram Devineni , Max Ver , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/2] seccomp: defer syscall_rollback() to get_signal() Message-ID: References: <202604151217.4E571EC3E4@keescook> 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: <202604151217.4E571EC3E4@keescook> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 04/15, Kees Cook wrote: > > I've spent some more time looking at all this. It does seem to me that > dropping syscall_exit_work() entirely for killed syscalls is the right way > to go for fixing the audit/trace/ptrace confusion on the exit side. OK, great. I'll try to make a patch as soon I have time. Hopefully this week. > But > I don't think it closes the whole problem. I guess we can discuss this in more detail later/separately? > Apologies for any verbosity > here, I'm kind of taking notes for myself too. :) Thanks for the detailed email ;) I will snip some parts for now... > I was trying to consider whether fixing this with a new ptrace event > (PTRACE_EVENT_SECCOMP_KILL or a new PTRACE_SYSCALL_INFO op) would be > better than reusing the existing signal-delivery stop (but perhaps in a > "read-only" mode). My sense is that a new event isn't worth it, Agreed, > So I'm thinking the full fix is to change what SA_IMMUTABLE actually > means: instead of "ptrace is disabled", it can be "the signal cannot > be changed (i.e. cannot stop the kill)". Which means in get_signal() > at the SA_IMMUTABLE check, stop gating ptrace_signal() on the flag and > instead pass the flag into ptrace_signal() (or check in other places) so > it can run in a "read-only" mode. OK, we can add something like PT_FREEZED which leaves in task->ptrace, but see below. > I think refusing tracer actions would be best, agreed > - syscall_exit_work() skips the exit tracehook, audit, and trace > when the syscall was RET_KILLed. Good ;) > - SA_IMMUTABLE stops disabling ptrace_signal() and starts gating > mutations within it. Honestly, I am not sure this is really useful... But I do not know. And again, we can discuss this later I hope. ---------------------------------------------------------------------- Now a stupid question ;) Why does __seccomp_filter() use syscall_rollback() anyway? OK, may be ax == orig_ax makes sense for coredump, I dunno. But case SECCOMP_RET_TRAP: /* Show the handler the original registers. */ syscall_rollback(current, current_pt_regs()); /* Let the filter pass back 16 bits of data. */ force_sig_seccomp(this_syscall, data, false); the handler can just use info.si_syscall instead of sigcontext.rax ? Oleg.