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 27FF51B4150 for ; Thu, 23 Jan 2025 22:35:35 +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=1737671737; cv=none; b=RzCvOiR1gX3hz3FMUdcZglVsUmynOL0k5FQJFIligxVmzwhbhws6YI/WVFrS7OksNaX2b6WmYVzccUyHOMB4uRR5zwJkqM8bsxf/Qr34p4MSIFAp+Y5lQiXyhNoO4VMfHIs4RSiJX8CUCrNv53w+K2Te47mgIj7vrubKMY/ZEfU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737671737; c=relaxed/simple; bh=GN6/8gO7Ibyvu13lPvwlyRjR7G7lG3V/OBlP/Vhfz1w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LHrn+9iOZmE7E15kRf/jAoL0p0eNhp/EbJ5GOns01mfT/4mEgPStzpV/+jlBl+GgaSnUTx+QcWIiHd4VaPHpLUoNgptOlUoOA6NnGe+nQv0Xk/un4b5wLHc7kCVtwENdLWhgVv62ZNl1jFp1/bpT4EDe47kF8OSj1/+Iw+rBBB8= 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 D2EFC72C8CC; Fri, 24 Jan 2025 01:35:34 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id C30957CCB3A; Fri, 24 Jan 2025 00:35:34 +0200 (IST) Date: Fri, 24 Jan 2025 00:35:34 +0200 From: "Dmitry V. Levin" To: Christophe Leroy Cc: Alexey Gladkov , Oleg Nesterov , Michael Ellerman , Eugene Syromyatnikov , Mike Frysinger , Renzo Davoli , Davide Berardi , strace-devel@lists.strace.io, Madhavan Srinivasan , Nicholas Piggin , Naveen N Rao , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/7] powerpc: properly negate error in syscall_set_return_value() Message-ID: <20250123223534.GB22814@strace.io> References: <20250113171054.GA589@strace.io> <6558110c-c2cb-4aa3-9472-b3496f71ebb8@csgroup.eu> <20250114170400.GB11820@strace.io> <20250123182815.GA20994@strace.io> <86079b5c-e124-489b-8136-05ae5700cb61@csgroup.eu> 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: <86079b5c-e124-489b-8136-05ae5700cb61@csgroup.eu> On Thu, Jan 23, 2025 at 11:07:21PM +0100, Christophe Leroy wrote: [...] > To add a bit more to the confusion, a task can be flagged with > TIF_NOERROR by calling force_successful_syscall_return(), in which case > even if gpr[3] contains a negative between -MAX_ERRNO and -1 the syscall > will be handled as successfull hence CCR[SO] won't be set. But it seems > this is not handled by syscall_set_return_value(). So what will happen > with time() when approaching year 2036 for instance ? syscall_set_return_value() takes both "int error" and "long val" arguments. It doesn't and shouldn't take TIF_NOERROR into account. With my patch applied, when it's called by PTRACE_SET_SYSCALL_INFO from do_syscall_trace_leave(), it will properly update gpr[3] and ccr regardless of TIF_NOERROR. If tracer wants to set an error status for a syscall that cannot return an error, it's up to the tracer to face the consequences. Tracers can do it now via PTRACE_SETREGS* anyway. -- ldv