Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4160279pxk; Tue, 8 Sep 2020 12:13:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnCyiCqR5q3ESCRZMr1TNLbTgHhptVxjBVBpxsccKVeANEFJOsUsiUa4eeNcUgqP70ITdN X-Received: by 2002:a17:906:cb98:: with SMTP id mf24mr6539148ejb.90.1599592390298; Tue, 08 Sep 2020 12:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599592390; cv=none; d=google.com; s=arc-20160816; b=zI26eiey739X+6lN3OvNUloa37T6SMKUzqy0AnnmQ7BNsSpM9KpMM6YpswkNuMmGCn Pol3qW1fi6g0+sxXnZt6lZDAGRQpINX/96ddXW7M2pvHQ7W3/D4AMbhjh8WNExOtVa7t eCufYbhrLIUr38r4lPqo3bpnL4SfDmxpx66E3hAxKHzDUis7R/LWyOWu2i8EjpGCAhEG lg7vaLJNSAeIxDpJo+tglKqDRhStBj2BYy2s0+4JmeSQ4f05uCcGuQC4ZzrRSYpeOsrS OGU2qiS07a+IUCZtRwfx6f5Ej6yIQ0aM5ycHgt2q5h+JncghQw2KXGQhpvTqa9UitqOb K+NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HEoRG9FZTZs0u5KFrTTNc1SLkrTfWPvbN5vfZrMi3eY=; b=HvB5UyhIbs0MsgPjlEGNvu6SfppSNyu9lJL0gAydrY7Ecl25D3BCQ+RHLUCx07CB7H mz7jIrXpof6u/iWykVS3yYl9mb0YeHcYCoD1YI8qTvQ7HkCtMX8I8PCmfph+mnzepJF/ l0CAYoUJgLPzj9NkI46Hl1EUKRbz4u2Eu2uPi1sVfAGRUUK0XQDn8t9Dx0SC0SHSOPZm vM5245TDcV4lLis7I1yMCU2Gvz18kZAhZJmw/ddp6KCata6IYJ14LdJJbvV63BWhNBwi lOy963YZziy1lXhmQygDaHj+NEd3cQ929sx8xFys71etCFwcxIqskdu54N/LaJyGgVT5 5dzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lSkDFdFW; 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=fail (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 gs20si6005225ejb.230.2020.09.08.12.12.46; Tue, 08 Sep 2020 12:13:10 -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=@kernel.org header.s=default header.b=lSkDFdFW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731117AbgIHTKy (ORCPT + 99 others); Tue, 8 Sep 2020 15:10:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:51454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731227AbgIHQFY (ORCPT ); Tue, 8 Sep 2020 12:05:24 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D599B227C3; Tue, 8 Sep 2020 15:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579964; bh=8ldGaysk1rOS0RCdkgORFtYP2YNgBG8K1SiOLUDPewA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lSkDFdFW4e1k+RdTTD2Zyx8nfjJB6CWWpCovFLI4sOhvn6+nF2B1mkTKUxIQVNmHU 4xdlBWIZEPpWvM7qB5Tpy2QhcGNiP4GaH11QxKMUalNvW80MTKfRWndRn53Ir3SphO 8k06ws1djVhO+pThVnzcl+OeJc0OXV6pKgnNIJHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vamshi K Sthambamkadi , Borislav Petkov , Masami Hiramatsu , "Peter Zijlstra (Intel)" Subject: [PATCH 5.4 077/129] tracing/kprobes, x86/ptrace: Fix regs argument order for i386 Date: Tue, 8 Sep 2020 17:25:18 +0200 Message-Id: <20200908152233.543918093@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vamshi K Sthambamkadi commit 2356bb4b8221d7dc8c7beb810418122ed90254c9 upstream. On i386, the order of parameters passed on regs is eax,edx,and ecx (as per regparm(3) calling conventions). Change the mapping in regs_get_kernel_argument(), so that arg1=ax arg2=dx, and arg3=cx. Running the selftests testcase kprobes_args_use.tc shows the result as passed. Fixes: 3c88ee194c28 ("x86: ptrace: Add function argument access API") Signed-off-by: Vamshi K Sthambamkadi Signed-off-by: Borislav Petkov Acked-by: Masami Hiramatsu Acked-by: Peter Zijlstra (Intel) Cc: Link: https://lkml.kernel.org/r/20200828113242.GA1424@cosmos Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/ptrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h @@ -309,8 +309,8 @@ static inline unsigned long regs_get_ker static const unsigned int argument_offs[] = { #ifdef __i386__ offsetof(struct pt_regs, ax), - offsetof(struct pt_regs, cx), offsetof(struct pt_regs, dx), + offsetof(struct pt_regs, cx), #define NR_REG_ARGUMENTS 3 #else offsetof(struct pt_regs, di),