From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (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 4E89B1DD0F2 for ; Sat, 25 Jan 2025 12:18:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737807493; cv=none; b=AE+9aBIUtMHMWSh62N8ZnXqgIb0Op8IIkjqrad6PQvHLAmmCMIPlSwaGWVd5h79B8C5y5F4t/kYWuq2QN3/t39QINKJ3N9syv3cvJnSB/D1TRaXsEU6fNwjcuyNJawQx2XwydM8s4Qq1hUWShK+MojAUcp/0hGO7fLhSuFpCNxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737807493; c=relaxed/simple; bh=Mg1nwyY473I2yl4k3486BHRi7Be/EI3RePG+U5eyYG8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=hSoyqh4qXp3BXutVBp4X2Es30PVJDV4T0dZSUBhluJksHNlDIdv+IYeNVhFNMj5iqiokOg/k1DOv6loUtjYy8Y2FAcTVKRZM2Fs4PSpB8WsKEJH4HdNV4wcdU9Tm+YUZXNYvXUqcnBNtuaBUlqvjbt4O9gRIaKJ7s2JdVFLZRCM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=m4kRzeqX; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="m4kRzeqX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1737807481; bh=ERLlPVG1lEJ+5piv0IiigUiUvltp7ufaJJs6c3as2xE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=m4kRzeqXgS6be31WXpCMul2w16MNgDr7qFDtkDEIiwi0AO892C8XIYehHpwIA2m9P tXJCEavqytSRyTgvnT2rCdpxISOSfqUkikjPHYPbkcEWADhfYG7d2NVVsWGtTARhlM 7paoJustxpjLfxKLzMhHFbBVqMGzyu6MueP02hkwyowAjCADPcdn9uKeBxjpZC3Sk0 KYluLrSFiaxClKykfkbaDM/utbgbpd1baCplWR5nq/eh47vuAg78BYVd22NiqiZQRj yiVQnLEpyci8wdKmV3waqffXq7V2l7uE5JJjJdZGt34XSghDzLouO72ljnBH2aTSOa 0dOdySLMjdjHg== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.ozlabs.org (Postfix) with ESMTPSA id 4YgDGd0BwNz4wvc; Sat, 25 Jan 2025 23:18:01 +1100 (AEDT) From: Michael Ellerman To: Alexey Gladkov , "Dmitry V. Levin" Cc: Christophe Leroy , Oleg Nesterov , 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() In-Reply-To: References: <20250113171054.GA589@strace.io> <6558110c-c2cb-4aa3-9472-b3496f71ebb8@csgroup.eu> <20250114170400.GB11820@strace.io> <20250123182815.GA20994@strace.io> <20250123234321.GA23582@strace.io> Date: Sat, 25 Jan 2025 23:18:06 +1100 Message-ID: <87ikq3jddt.fsf@mpe.ellerman.id.au> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Alexey Gladkov writes: > ... > I'm not a powerpc expert but shouldn't be used regs->gpr[3] via a > regs_return_value() in system_call_exception() ? Yes I agree. > notrace long system_call_exception(struct pt_regs *regs, unsigned long r0) > { > ... > r0 = do_syscall_trace_enter(regs); > if (unlikely(r0 >= NR_syscalls)) > return regs->gpr[3]; This is the case where we're expecting the r3 value to be a negative error code, to match the in-kernel semantics. But after this change it would be a positive error value. It is probably harmless with the current code structure, but that's just luck. cheers