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 6F9E112CDA5 for ; Wed, 29 Jan 2025 14:15:15 +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=1738160118; cv=none; b=pgDnjLNjPltvYJEckub+bWWzvA2gSiRo0QtlbAY+7mwmi6U7a9Jqh0mPzbovJE/EDso5KdDJaY6UsQw4qmT1bVDle5zjC4WgsZkpBwFrbYs+gnrW9cpy9NG6Qa878qwn95RQaAreH4jDd1mQmYHBlLxHEpsgBwtOMoo0yA6m1o0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738160118; c=relaxed/simple; bh=6R64CpVpqMJMJJWqVBJeogdh1MIOAsIGRv483voaktg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mL6Y0Yn7hdeqzWT5JUoFGZqkZgmDdSoNCDROD+YeTcV+xvJSxeebKBU5k9fBvpBUD2XoSq5QJG4qucRQugI/Dwv+rrlMQImTVLdo/ugK5lZ1WsCqZDIki9KFdOXxaEMOShkdm/l1XtAYPbLJdspV3KX9u48zsUuSSGZDOjnEZJU= 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 22C3F72C97D; Wed, 29 Jan 2025 17:15:14 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 12E937CCB3A; Wed, 29 Jan 2025 16:15:14 +0200 (IST) Date: Wed, 29 Jan 2025 16:15:14 +0200 From: "Dmitry V. Levin" To: Nicholas Piggin Cc: Oleg Nesterov , Eugene Syromyatnikov , Mike Frysinger , Renzo Davoli , Davide Berardi , strace-devel@lists.strace.io, Madhavan Srinivasan , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/2] powerpc: change syscall error return scheme Message-ID: <20250129141513.GA21809@strace.io> References: <20250129132148.301937-1-npiggin@gmail.com> 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: <20250129132148.301937-1-npiggin@gmail.com> Hi, On Wed, Jan 29, 2025 at 11:21:41PM +1000, Nicholas Piggin wrote: > Hi, > > I've been toying with the seccomp vs syscall return value problems, and > wonder if something like this approach could give us a simpler alternative. > Basically all the core code uses -errno return value, then we convert it > to the powerpc convention at the last minute when returning. > > This seems to pass the seccomp_bpf test cases when applied with the set > syscall info ptrace patches > > https://lore.kernel.org/lkml/20250113171054.GA589@strace.io/ > > With patch 1 of that series reverted. > > One concern is working out exact details of what tracers can see and > trying to ensure it doesn't break some corner case. Does the strace test suite also pass with your changes? My bet is it doesn't pass because do_syscall_trace_leave() is called with a different state of struct pt_regs. As I wrote yesterday, the traditional powerpc sc syscall return ABI is exposed to user space not just when returning to user space, but, besides that, at syscall exit tracepoint (trace_sys_exit), ptrace syscall exit stop (ptrace_report_syscall_exit), and PTRACE_EVENT_SECCOMP stop (__secure_computing). There could be other points where this is exposed. For example, on many architectures the tracer can specify syscall error return value also at ptrace syscall entry stop (ptrace_report_syscall_entry), but powerpc does not implement this. -- ldv