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 D4127353A64 for ; Thu, 2 Jul 2026 14:47:23 +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=1783003645; cv=none; b=JabAgRT7+PvLxd6wtzIlJKh1l72beZNUqQMYfoK/jVl9KOvQHVgtLy18XxSWD5yTDFMWrKTEXEmL7WWb4hNVx1UX1OE+mclLMduRdHZG7wrUPD57gzHvZpcPhCdGIvNrLgKxGTn0V6qdUiLZJEg9ujPNy4QxYHlV7SdpmJ8fUrA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783003645; c=relaxed/simple; bh=dBVa5kwRgdBdramX9KEBufdHzRB8bDquqll6T4UqE1M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=T6yR8/4eB/MB+z9q0MBwf4ksQfQ/1hw+vcjJMWICZMUgBab+npopCxolGKVKMuXpPqhRTq7mBUygfdONRSDW/yJKARMQBFA3mtx1Z2rYmdo1vJWTRILYVaWFHf7wS5LjwvYC8oC6cWw7o8Q9itg25jyynXaOmrI1Qa4pvh4EewI= 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=U6eHqTBG; 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="U6eHqTBG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783003642; 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=Am+j7UVI4jltfER32Hfzk3IFEIYYzI7ZVZ32PpXDcgA=; b=U6eHqTBGeMaziWOSWn3v8SAd8/7ve1Fc01eaKkb/tcB9Fk4FZYmgATJWekC4cqC8J05Qgb fAQZ1DJRb7OABh9MrpATP/SaO0vAf092NBy+eIWHP8zUDgciK+tU3KP1cCtfyEwmAGn4rN GbFk9PjD9psxft5oIBTrSEMVSX0Z6n0= 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-377-jwlipIkFO2-o2UtH7GdgNw-1; Thu, 02 Jul 2026 10:47:18 -0400 X-MC-Unique: jwlipIkFO2-o2UtH7GdgNw-1 X-Mimecast-MFC-AGG-ID: jwlipIkFO2-o2UtH7GdgNw_1783003634 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 2FACE184B0B8; Thu, 2 Jul 2026 14:47:14 +0000 (UTC) Received: from fedora (unknown [10.44.32.200]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 3778D36F0F; Thu, 2 Jul 2026 14:47:09 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 2 Jul 2026 16:47:13 +0200 (CEST) Date: Thu, 2 Jul 2026 16:47:08 +0200 From: Oleg Nesterov To: "Dmitry V. Levin" Cc: Renzo Davoli , linux-kernel@vger.kernel.org, Andrew Morton , Shuah Khan , Alexey Gladkov , Eugene Syromyatnikov , Mike Frysinger , Davide Berardi , strace-devel@lists.strace.io Subject: Re: [PATCH 1/5] ptrace: add PTRACE_SYSCALL_INFO_SECCOMP_SKIP Message-ID: References: <20260701150558.330348-1-renzo@cs.unibo.it> <20260701150558.330348-2-renzo@cs.unibo.it> <20260702110755.GA16303@strace.io> 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.6 on 10.30.177.95 On 07/02, Oleg Nesterov wrote: > > Or we can simply allow the ENTRY/SECCOMP -> EXIT transition, I dunno. > This is more safe. and more simple > But somehow I don't like the new PTRACE_SYSCALL_INFO_SECCOMP_SKIP... Wdyt about something like below? Oleg. --- diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 130043bfc209..ecbfa28dfbf6 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -1084,7 +1084,7 @@ ptrace_set_syscall_info_seccomp(struct task_struct *child, struct pt_regs *regs, static int ptrace_set_syscall_info_exit(struct task_struct *child, struct pt_regs *regs, - struct ptrace_syscall_info *info) + struct ptrace_syscall_info *info, bool force) { long rval = info->exit.rval; @@ -1101,6 +1101,9 @@ ptrace_set_syscall_info_exit(struct task_struct *child, struct pt_regs *regs, else syscall_set_return_value(child, regs, 0, rval); + if (force) + syscall_set_nr(child, regs, -1); + return 0; } @@ -1110,6 +1113,7 @@ ptrace_set_syscall_info(struct task_struct *child, unsigned long user_size, { struct pt_regs *regs = task_pt_regs(child); struct ptrace_syscall_info info; + bool force = false; if (user_size < sizeof(info)) return -EINVAL; @@ -1127,14 +1131,17 @@ ptrace_set_syscall_info(struct task_struct *child, unsigned long user_size, return -EINVAL; /* Changing the type of the system call stop is not supported yet. */ - if (ptrace_get_syscall_info_op(child) != info.op) - return -EINVAL; + if (ptrace_get_syscall_info_op(child) != info.op) { + if (info.op != PTRACE_SYSCALL_INFO_EXIT) + return -EINVAL; + force = true; + } switch (info.op) { case PTRACE_SYSCALL_INFO_ENTRY: return ptrace_set_syscall_info_entry(child, regs, &info); case PTRACE_SYSCALL_INFO_EXIT: - return ptrace_set_syscall_info_exit(child, regs, &info); + return ptrace_set_syscall_info_exit(child, regs, &info, force); case PTRACE_SYSCALL_INFO_SECCOMP: return ptrace_set_syscall_info_seccomp(child, regs, &info); default: