Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3419735pxf; Mon, 29 Mar 2021 01:31:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxem46SKZAMIYgDLWeUm1HVtSmDsKVvWbSRqqO9qL96CZs8Rpger2f4ld0wQSKLgbPBa1X2 X-Received: by 2002:a17:907:d0b:: with SMTP id gn11mr27199284ejc.463.1617006667000; Mon, 29 Mar 2021 01:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617006666; cv=none; d=google.com; s=arc-20160816; b=oQU+z5NINiwqkuV04zuP85j4nuWISTzDQlw9jMmOM7lOYmIocWR+rkT0UPUZukD02n WFfvq8sICz4AFzBOXr6l3nhNG3kgRxKryI5fEn+BLDPQYGxbQ8TNmCCjuExDw77WeNH0 uAoQ1o7YbkgLKX4VniP8LsjI4fqCmTfy2iubbvohnRTCU7GqiZ35Ok1FuU9gXJFI8OyP rG39gUTSkV5ycHzaD5xQ+6p1DJXrUt+iB+Yf8bc9tQbDlNQ4h8QXmon7jpr/rKFSDtun dA+yBLthG/TyDtVoR2IDai0liNvcA1OZKyJ34Qb6M29/CuZuzkOmEKecrj/1/EY7b8nw ODuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Si7r2AICmFzxePRqOZal/B1EtwFaIWfNhGdZXmORj5M=; b=Dt5NTktZ+yNl17EvoRVEqkaf5GXBnyuuzp2cPni9aUjHysoPnLXq+qTP1bB2yZigmi ggLrRXhcKqCbKlaGxmGw0wBb5Y9n6jRuYyJDLjfobXDYGpkvWpIeDjxR3ZroCKjYMy4F lSoYIcOq5NI0lbFzC7fwhX/TcPWDMwj4cov65MMhWyP/KeOkmvXN4zBYNgqDFqTHX2Vq A7jpQv7h1kLeQbVVekcheYhSl3IYBHdYO2e5vIPephhc5C8SH5RaeokcrngwjUTM+GRA 0XpaXgfww+givWbyPc55lK4VI5fU+dzNUuJ4BhImbzUHqLQffS0M4zQTGaECdC+qr/AF CQGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JC2zqrSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ji5si12901206ejc.360.2021.03.29.01.30.44; Mon, 29 Mar 2021 01:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JC2zqrSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233409AbhC2I3c (ORCPT + 99 others); Mon, 29 Mar 2021 04:29:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:35330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbhC2ISz (ORCPT ); Mon, 29 Mar 2021 04:18:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 51FE561601; Mon, 29 Mar 2021 08:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617005934; bh=IbK9jyQI8KiJR0IZteICTrmpT+15gQ4hoLVWkZBduP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JC2zqrSLm9Xblsr1+NjqV1dKhdoWrumTKVqmxhDazrUBO9bB1Fmv40GtZB/pel5rV 6BVwovNOMqBJeSD62pIWihKpJQxNn9ZvIQrWC79Zs/r0K3pe15zIziNuCDLLgbnucw p2eUiRpXp6Xb4gGa0LJt0ByWpSsY9L2e6tCRHI7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Trofimovich , "Dmitry V. Levin" , John Paul Adrian Glaubitz , Oleg Nesterov , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.10 056/221] ia64: fix ptrace(PTRACE_SYSCALL_INFO_EXIT) sign Date: Mon, 29 Mar 2021 09:56:27 +0200 Message-Id: <20210329075631.069198063@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergei Trofimovich [ Upstream commit 61bf318eac2c13356f7bd1c6a05421ef504ccc8a ] In https://bugs.gentoo.org/769614 Dmitry noticed that `ptrace(PTRACE_GET_SYSCALL_INFO)` does not return error sign properly. The bug is in mismatch between get/set errors: static inline long syscall_get_error(struct task_struct *task, struct pt_regs *regs) { return regs->r10 == -1 ? regs->r8:0; } static inline long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs) { return regs->r8; } static inline void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, int error, long val) { if (error) { /* error < 0, but ia64 uses > 0 return value */ regs->r8 = -error; regs->r10 = -1; } else { regs->r8 = val; regs->r10 = 0; } } Tested on v5.10 on rx3600 machine (ia64 9040 CPU). Link: https://lkml.kernel.org/r/20210221002554.333076-2-slyfox@gentoo.org Link: https://bugs.gentoo.org/769614 Signed-off-by: Sergei Trofimovich Reported-by: Dmitry V. Levin Reviewed-by: Dmitry V. Levin Cc: John Paul Adrian Glaubitz Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- arch/ia64/include/asm/syscall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h index 6c6f16e409a8..0d23c0049301 100644 --- a/arch/ia64/include/asm/syscall.h +++ b/arch/ia64/include/asm/syscall.h @@ -32,7 +32,7 @@ static inline void syscall_rollback(struct task_struct *task, static inline long syscall_get_error(struct task_struct *task, struct pt_regs *regs) { - return regs->r10 == -1 ? regs->r8:0; + return regs->r10 == -1 ? -regs->r8:0; } static inline long syscall_get_return_value(struct task_struct *task, -- 2.30.1