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 79C321C5D4D for ; Mon, 13 Jan 2025 17:10:55 +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=1736788256; cv=none; b=Yepv4hdbMlYpert2NiSK7jEVhGG3n+gfkkY+vuwSzFMFBanL0tSUOCPg9NFMsor9ex4PkY8gUL37DwNXnp0jgA/tuZKyNWwaPHg+KM6Ud/Afchtim7B3t+VhEvbD2lDZcCJPEDLH9ElmWvczxhrDQv07xQZ+9bqKRZqWC+DX654= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736788256; c=relaxed/simple; bh=xrNc1CPFugCjKC0wXfr0vWYr/3W+xXNzroSkt/b8ib0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=GBMTB04i70epR9DYA8w1dmhyC9cr/dXvk2Ie+rSD0scQZ8VD6Uo7z9pgoxJDGSlt3FNjpaxqWn1hg8BsrIQL8V2gBeLSH0oo/KlWgU4S401vS2v+acEMmRC8pieKn4bpWW0DNbvLPHWvf6vfYJE4U1VNU6n/bZcLujOtFKTBSnQ= 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 5D76072C8CC; Mon, 13 Jan 2025 20:10:54 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 52A327CCB3A; Mon, 13 Jan 2025 19:10:54 +0200 (IST) Date: Mon, 13 Jan 2025 19:10:54 +0200 From: "Dmitry V. Levin" To: Oleg Nesterov , Michael Ellerman Cc: Eugene Syromyatnikov , Mike Frysinger , Renzo Davoli , Davide Berardi , strace-devel@lists.strace.io, Madhavan Srinivasan , Nicholas Piggin , Christophe Leroy , Naveen N Rao , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/7] powerpc: properly negate error in syscall_set_return_value() Message-ID: <20250113171054.GA589@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: <20250113170925.GA392@strace.io> Bring syscall_set_return_value() in sync with syscall_get_error(), and let upcoming ptrace/set_syscall_info selftest pass on powerpc. This reverts commit 1b1a3702a65c ("powerpc: Don't negate error in syscall_set_return_value()"). Signed-off-by: Dmitry V. Levin --- arch/powerpc/include/asm/syscall.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h index 3dd36c5e334a..422d7735ace6 100644 --- a/arch/powerpc/include/asm/syscall.h +++ b/arch/powerpc/include/asm/syscall.h @@ -82,7 +82,11 @@ static inline void syscall_set_return_value(struct task_struct *task, */ if (error) { regs->ccr |= 0x10000000L; - regs->gpr[3] = error; + /* + * In case of an error regs->gpr[3] contains + * a positive ERRORCODE. + */ + regs->gpr[3] = -error; } else { regs->ccr &= ~0x10000000L; regs->gpr[3] = val; -- ldv