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 E3737347C6 for ; Sun, 22 Mar 2026 17:32:55 +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=1774200777; cv=none; b=E2B0ijPvY8w2j1neo4XLQzPTlErE0eIBSMAAcp3XuBq86gWdxP9bi2g/aSCqC0NrOK0AB2f6Ky1erjbyShcn3srw6C1keP2zQvQReYMFxdEjG1RGZh9uvmwDnwwDjRVPSufhCHtwfvQIcBMDaJK7dLjfKB5iX4efh/ilmn8FG+E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774200777; c=relaxed/simple; bh=M5Mlf5eWA+c5b9RpvQkS6eH5VbReKs+pXxRa6dy2/z8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ET1i0sRMS36OP4B2CNZICmMSCEYkHrZQNYN9mjQ6oitGIJ2ElKFXiCOZS4LfC6yOh+Ff8X9+W9HzOHiH69PO7d+KCjTWFzYAbcZ5LZp2CIiIe6TdW4wnV2oBOGWYUog5HBElXbd8SmUZ5y6megyQEZCTvbX6N8Wa2rAYqjbGRqI= 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=ft+AzKgw; 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="ft+AzKgw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774200774; 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=WM+IQfwarCsNtQrKuVelnIEn8iRAeiGDyPiqgbURjso=; b=ft+AzKgwKD7pLOKH9tthe+JdPM1qE9siSjiZo85kxf4e9yjYNLq8ZD+WX8nfLj8kHvJQia 3CCn3gxpLzMHxatC2qJ8YALx5TSMXmX/NWjDQ6MldZKr0SbkAgRTUfw0vqPRqmo0kOfwW9 viVHRFa9QDTYScQu1VkEpOPum02tb3s= 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-NvZ0DGgpPMW3MKYsPZcEHA-1; Sun, 22 Mar 2026 13:32:51 -0400 X-MC-Unique: NvZ0DGgpPMW3MKYsPZcEHA-1 X-Mimecast-MFC-AGG-ID: NvZ0DGgpPMW3MKYsPZcEHA_1774200769 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 4C669180035C; Sun, 22 Mar 2026 17:32:49 +0000 (UTC) Received: from fedora (unknown [10.44.32.25]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id B596A1955D71; Sun, 22 Mar 2026 17:32:45 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 22 Mar 2026 18:32:48 +0100 (CET) Date: Sun, 22 Mar 2026 18:32:44 +0100 From: Oleg Nesterov To: Andrew Morton Cc: Andy Lutomirski , Kees Cook , 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: <20260322093656.2e327439df04b183078e5cef@linux-foundation.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: <20260322093656.2e327439df04b183078e5cef@linux-foundation.org> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 03/22, Andrew Morton wrote: > > On Sun, 22 Mar 2026 14:44:54 +0100 Oleg Nesterov wrote: > > > __seccomp_filter() does > > > > case SECCOMP_RET_KILL_THREAD: > > case SECCOMP_RET_KILL_PROCESS: > > ... > > /* Show the original registers in the dump. */ > > syscall_rollback(current, current_pt_regs()); > > > > /* Trigger a coredump with SIGSYS */ > > force_sig_seccomp(this_syscall, data, true); > > > > syscall_rollback() does regs->ax == orig_ax. This means that > > ptrace_get_syscall_info_exit() will see .is_error == 0. To the tracer, > > it looks as if the aborted syscall actually succeeded and returned its > > own syscall number. > > > > And since force_sig_seccomp() uses force_coredump == true, SIGSYS won't > > be reported (see the SA_IMMUTABLE check in get_signal()), so the tracee > > will "silently" exit with error_code == SIGSYS after the bogus report. > > > > Change syscall_exit_work() to avoid the bogus single-step/syscall-exit > > reports if the tracee is SECCOMP_MODE_DEAD. > > > > TODO: With or without this change, get_signal() -> ptrace_signal() may > > report other !SA_IMMUTABLE pending signals before it dequeues SIGSYS. > > Perhaps it makes sense to change get_signal() to check SECCOMP_MODE_DEAD > > too and prioritize the fatal SIGSYS. > > AI review has questions: > https://sashiko.dev/#/patchset/ab_yVqQ7WW3flal3@redhat.com Excellent question ;) Thanks sashiko! I will have this in mind when (if) I send V2. So far my main concern is the behavioral change caused by my RFC, I will wait for more comments before that. In any case: yes! I have missed another syscall_rollback() on SECCOMP_RET_TRAP in __seccomp_filter(). In this case force_sig_seccomp() uses force_coredump == false, so SIGSYS will be reported. But this doesn't really make a difference wrt ptrace confusion. Thanks! Oleg.