From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20D3B1BFE10 for ; Tue, 28 Jan 2025 16:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738081206; cv=none; b=Dkd2CyUoJdEFeLnS/vDXtsKilRDL6VoK7AY/S5Q6k36mq6cI5GvXyqavQKOcuWRi6mP0jzlK+3pgPhpuyktBcc4DSf3N0j4nEdJEKu9/nnnySAMX2zpOrXFBKAWwm2n0P0+mPoNSCJR6GM6z8l54L3cw9yJOpKKDE+PhOEn7sRQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738081206; c=relaxed/simple; bh=u/d2A7jIgmGS+Io3oorjhaJx6HLGk6lQV48sxfCdRwc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MFyrCbo6tRB83GDxu133Nl8uMCcfmiTJtYWazyl6QC+IbTe8hiOPSpDQ7G3IFfHe2xm7twk9bccKOHwamYw3ONfErukte5dmtsPkNKhGhARVnk/d+jThfXK6P03l+AVw2/VP2fsTsUnEKxSpXcRqabxKd0ZQl7mtpqyypSreynU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Yj94J0X4Kz9sRs; Tue, 28 Jan 2025 17:00:48 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fmQ22RbPmDdv; Tue, 28 Jan 2025 17:00:47 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Yj9400Ngcz9sSY; Tue, 28 Jan 2025 17:00:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F06038B76C; Tue, 28 Jan 2025 17:00:31 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id auU5-9tFQgiC; Tue, 28 Jan 2025 17:00:31 +0100 (CET) Received: from [192.168.235.99] (unknown [192.168.235.99]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 69DFB8B763; Tue, 28 Jan 2025 17:00:31 +0100 (CET) Message-ID: Date: Tue, 28 Jan 2025 17:00:31 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] powerpc: properly negate error in syscall_set_return_value() in sc case To: "Dmitry V. Levin" Cc: Michael Ellerman , Alexey Gladkov , Eugene Syromyatnikov , Oleg Nesterov , Madhavan Srinivasan , Nicholas Piggin , Naveen N Rao , linuxppc-dev@lists.ozlabs.org, strace-devel@lists.strace.io, linux-kernel@vger.kernel.org References: <20250127181322.GA1373@strace.io> <20250128155201.GA11869@strace.io> Content-Language: fr-FR From: Christophe Leroy In-Reply-To: <20250128155201.GA11869@strace.io> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 28/01/2025 à 16:52, Dmitry V. Levin a écrit : > On Tue, Jan 28, 2025 at 03:59:29PM +0100, Christophe Leroy wrote: >> Le 27/01/2025 à 19:13, Dmitry V. Levin a écrit : >>> According to the Power Architecture Linux system call ABI documented in >>> [1], when the syscall is made with the sc instruction, both a value and an >>> error condition are returned, where r3 register contains the return value, >>> and cr0.SO bit specifies the error condition. When cr0.SO is clear, the >>> syscall succeeded and r3 is the return value. When cr0.SO is set, the >>> syscall failed and r3 is the error value. This syscall return semantics >>> was implemented from the very beginning of Power Architecture on Linux, >>> and syscall tracers and debuggers like strace that read or modify syscall >>> return information also rely on this ABI. >> >> I see a quite similar ABI on microblaze, mips, nios2 and sparc. Do they >> behave all the same ? > > Yes, also on alpha. I don't think microblaze should be in this list, > though. Microblaze has static inline void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, int error, long val) { if (error) regs->r3 = -error; else regs->r3 = val; } So it has a positive error setting allthough it has no flag to tell it is an error. Wondering how it works at the end. Alpha I'm not sure, I see nothing obvious in include/asm/ptrace.h or include/asm/syscall.h