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 06F033E5A12 for ; Wed, 8 Jul 2026 22:09:29 +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=1783548572; cv=none; b=hjk3/81y+ZAmCHD+4OZgttOGxomfZPS1Hu+67r6MpyKBYPXQOJPwrTnMayvbVcnRn1v5yPynOydrvc/7fXiBJx89FxaTfsq5yxzwrYixfFcncyWd2AZ5I1jpzXnoZtzViHtvStC/2SV6aspqGGCqeJKudrVdGGitYI8oj9BoU+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783548572; c=relaxed/simple; bh=CU/+R7DkUIQFFDuJHc9cyWPdM3RY6J4ONHXMgH3ZrB0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZS/7Jant8LbhvbK513ldoonQ13sy+1THJJphI8dQyH5MtbPeLXqzTFpkdLZFCl9y1rGaYVt4QJxWYStkK7YqM3/CLzi8fJRSaaSTemcPk6JD9eH1kHIkSnbgtKRQZ1Ykqxppay14/z3DSOFatWG6tKWtT9IjgYPGGkSAIa6qhl4= 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 380E272C8CC; Thu, 9 Jul 2026 01:09:23 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 2A8397CCB3A; Thu, 9 Jul 2026 01:09:23 +0300 (IDT) Date: Thu, 9 Jul 2026 01:09:23 +0300 From: "Dmitry V. Levin" To: Oleg Nesterov Cc: Renzo Davoli , linux-kernel@vger.kernel.org, Andrew Morton , Shuah Khan , Alexey Gladkov , Eugene Syromyatnikov , Davide Berardi , strace-devel@lists.strace.io Subject: Re: [PATCH v4 1/2] ptrace: add PTRACE_SET_SYSCALL_INFO syscall skipping support Message-ID: <20260708220923.GA4523@strace.io> References: <20260708090655.38432-1-renzo@cs.unibo.it> <20260708090655.38432-2-renzo@cs.unibo.it> <20260708153250.GA32399@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 Wed, Jul 08, 2026 at 05:44:08PM +0200, Oleg Nesterov wrote: > On 07/08, Dmitry V. Levin wrote: > > > > On Wed, Jul 08, 2026 at 11:06:54AM +0200, Renzo Davoli wrote: > > > > > System call suppression for PTRACE_SYSCALL_INFO_ENTRY is currently omitted > > > because its implementation is architecture-dependent. On some architectures, > > > the system call number and return value share the same register, making it > > > difficult to suppress a system call without altering the return value. A > > > portable implementation would require an audit of all supported architectures. > > > > I suggest the following wording for the explanation why > > PTRACE_SYSCALL_INFO_ENTRY is not supported yet: > > > > System call suppression via PTRACE_SYSCALL_INFO_ENTRY is currently not > > implemented. On some architectures (e.g. MIPS), when a system call > > is skipped by setting the syscall number to -1 at the entry stop, the > > architecture entry path unconditionally overwrites the return value > > register with -ENOSYS before the tracer can set a custom return value > > at the exit stop. > > Thanks! but looks a bit misleading or (quite possibly) I am confused... > > At least for MIPS, I think it should something like > > when a system call is skipped by setting the syscall number to -1 > > ... > > architecture entry path unconditionally overwrites the return value > register with -ENOSYS > > ... > > _after_ (or even if ) the tracer has already set a custom return value > > No? Sure, thanks for spotting. Consider the following edition: System call suppression via PTRACE_SYSCALL_INFO_ENTRY is currently not implemented. On some architectures (e.g. MIPS), when a system call is skipped by setting the syscall number to -1 at the entry stop, the architecture entry path unconditionally overwrites the return value register with -ENOSYS, clobbering any custom return value set by the tracer at the entry stop. -- ldv