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 6A393435A91 for ; Thu, 9 Jul 2026 13:47:18 +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=1783604840; cv=none; b=knwi9on0GVV4HcJ7TE9UbqiWfys/JAH3A3jajBPZEP8LbBLQJaCooRduSguZeP9KYcjguN3X28m+YAJcwR0vMOth77Cbf8rr8Qo4JKPxue4liMuLzYgyvlRRFDeRAZ+wRZ3U5LhjhZCEILm0u34gHkh87EG7yTh1WU/QwM5QFA8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783604840; c=relaxed/simple; bh=t3xLlDegxUVNkwNgZzkiPMKEDfQhnoZ7JgaR8vQRLH8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IkG91tzd4ME08ISM4DOFRTwts0nFnFsHgfR9b0AFu6M+IkUfSgJvm6kOOUN9XbjriYCuaRHnLSeIZ67EYdSv/GvFh8Jt3dL0CbH0e/ylPpBxvtk7uKYr+WL4hl4JasKlLa+ZUdNGtbeufeim7ZmHQHuqfjZUFSEbfG5XqdlXdjQ= 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=NGxcIDEL; 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="NGxcIDEL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783604837; 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=nBk3cXWImvlgfAcD2+PHQbXUQTvvbd/OOg0qkKx6TAc=; b=NGxcIDELD8mQuPSBJqEOKlMYHYq0rAtpUHyv0V6+Vyoao5kZOwxqxd6ZtB0yObySOtDmru IGV8IwviDovWxiLcsLL/9N2ZjSIsD0nLCbEYq7Ls+fN74BAvPDIPYSlp/gBThY9GFe5Kks dPSPoP+m7o9rF2iOGhtwU/LgWl6C2pI= 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-111-KJ5hlcDTPIynYF_uwyUWjQ-1; Thu, 09 Jul 2026 09:47:12 -0400 X-MC-Unique: KJ5hlcDTPIynYF_uwyUWjQ-1 X-Mimecast-MFC-AGG-ID: KJ5hlcDTPIynYF_uwyUWjQ_1783604829 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 E09AA1800844; Thu, 9 Jul 2026 13:47:08 +0000 (UTC) Received: from fedora (unknown [10.44.49.164]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 41A631955D71; Thu, 9 Jul 2026 13:47:04 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 9 Jul 2026 15:47:08 +0200 (CEST) Date: Thu, 9 Jul 2026 15:47:03 +0200 From: Oleg Nesterov To: "Dmitry V. Levin" Cc: Sven Schnelle , strace development discussions , linux-kernel@vger.kernel.org, Renzo Davoli , Andrew Morton , Shuah Khan , Alexey Gladkov , Eugene Syromyatnikov , Davide Berardi Subject: Re: [PATCH v2 1/5] ptrace: PTRACE_SET_SYSCALL_INFO syscall skipping support Message-ID: References: <20260703105027.539399-1-renzo@cs.unibo.it> <20260703105027.539399-2-renzo@cs.unibo.it> <20260709075923.GA16739@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: <20260709075923.GA16739@strace.io> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 07/09, Dmitry V. Levin wrote: > > On Thu, Jul 09, 2026 at 09:04:34AM +0200, Sven Schnelle wrote: > > Renzo Davoli writes: > > > > > This patch extends PTRACE_SET_SYSCALL_INFO with support for skipping a system > > > call triggered via seccomp. > > > > > > When the tracer retrieves a ptrace_syscall_info structure with > > > op == PTRACE_SYSCALL_INFO_SECCOMP, it may choose to skip the system > > > call by changing op to PTRACE_SYSCALL_INFO_EXIT and > > > populating the exit union fields (rval and is_error) to define > > > the return value and error status for the tracee. > > > > Is it possible to indicate the information whether the syscall should be > > skipped via a dedicated return value? > > Currently, there is no API for that, so everybody has been using -1 for > that purpose. > > > There's currently work going on[1] > > to do this for seccomp, and it would be awkward if ptrace introduces > > this at the same time. > > If someday there would be a better API for that, ptrace could be able to > use it as well. Agreed, but... This probably needs another discussion, but so far (rightly or not) I don't think this needs any changes in ptrace paths. IOW. If debugger does set_syscall_nr(-1) the syscall should be skipped. And it will be skipped. Yes, ptrace_report_syscall() doesn't return false in this case, but IMO we do not care (at least in the context of this discussion). Yes, this means that in this case syscall_trace_enter() (at least in include/linux/entry-common.h) will still call trace_syscall_enter() and syscall_enter_audit() but I see nothing wrong with that. In fact, right now I think we should not change this behaviour. Now back to the problem. Please see [patch 00/18] entry: Consolidate and rework syscall entry handling https://lore.kernel.org/all/20260707181957.433213175@kernel.org/ In particular, let me quote the note from https://lore.kernel.org/all/87se5tqkyp.ffs@fw13/ Presetting the return value to -ENOSYS has been practice for three decades. ... 1) The set in stone rule is that if the entry code returns -1L as the syscall number then the architecture code has to skip the syscall invocation _and_ is not supposed to change the return value. I agree. And to me this means that arch/mips is simply wrong (even if this arch doesn't use entry-common afaics) and it should be fixed. Oleg.