From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5248137FF6F for ; Mon, 6 Jul 2026 14:16:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.107.17.57 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783347409; cv=none; b=nmpXzGWBVR5uwA9bIFvUWOg+w1PbCO+PXG7GAXqCm2iGMJ6mDmJHFFjNRledT5kkgfPSLFwjA7VGRjUrLiJ6aJ75aqnmPTuM+gE/tPzCm+hYTx17hTkfbC9RfpZEA+iG/9sD1bXI0ZHMKaihgD8CAc3YZFFEoM1G3GlF9mFzkOQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783347409; c=relaxed/simple; bh=XpFvcATJCpELWspr5d4AuDgdoPIGCdZWgH2cgwjF8+I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Uxxg19Gvbyo4eLc8TlO71Ln6eeTU7Sh6TiyaTiSb15NH+GZ7Me6PJrghW8xm7iypXrRrEe/yD3mUSJ5cq71CvyaFVfkW6eDn9MKX0kccXfE5OtVHC3sQk77xg2DEJTujAp2MeSyyVVw+6B0fAHINg+DTCyG+nuID3tPr/m2xLWA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strace.io; spf=pass smtp.mailfrom=altlinux.org; arc=none smtp.client-ip=194.107.17.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strace.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 5B31E72C8CC; Mon, 6 Jul 2026 17:16:40 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 4DCE67CCB3A; Mon, 6 Jul 2026 17:16:40 +0300 (IDT) Date: Mon, 6 Jul 2026 17:16:40 +0300 From: "Dmitry V. Levin" To: Oleg Nesterov 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: <20260706141640.GA5029@strace.io> 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: On Thu, Jul 02, 2026 at 01:31:08PM +0200, Oleg Nesterov wrote: > On 07/02, Dmitry V. Levin wrote: > > On Thu, Jul 02, 2026 at 11:58:14AM +0200, Oleg Nesterov wrote: > > [...] > > > @@ -1047,6 +1069,11 @@ ptrace_set_syscall_info_entry(struct task_struct *child, struct pt_regs *regs, > > > if (nr != info->entry.nr) > > > return -ERANGE; > > > > > > + syscall_set_nr(child, regs, nr); > > > + if (nr == -1) > > > + return __set_syscall_info_exit(child, regs, > > > + info->entry.rval, info->entry.is_error); > > > > The kernel shouldn't suddenly start interpreting info->entry.rval and > > info->entry.is_error because the current users of this interface are not > > aware that the kernel might be doing it. If we want to extend > > PTRACE_SYSCALL_INFO_ENTRY/PTRACE_SYSCALL_INFO_SECCOMP this way, we would > > have to require setting a flag in info->flags signalling the kernel that > > the user requests this new behaviour. > > Ah. I forgot to mention that (obviously) this is a user-visible change, > and a new flag in info->flags will be safer. Of course. > > Or we can define a special SKIP_AND_SET_RVAL value for info->entry.nr. > > But I am just curious, will this change (without new flag) actually break > strace? What does strace do when it uses PTRACE_SYSCALL_INFO_ENTRY with > info->entry.nr == -1? When strace is used for syscall tampering, it first performs a quick PTRACE_SET_SYSCALL_INFO runtime check - very similar to the test in tools/testing/selftests/ptrace/set_syscall_info.c. If this check fails, strace assumes the PTRACE_SET_SYSCALL_INFO interface is unavailable. Changing the PTRACE_SYSCALL_INFO_ENTRY behavior this way would cause that initialization check to fail, meaning strace would gracefully fall back and not use the interface at all. -- ldv