From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41F7AC43461 for ; Tue, 8 Sep 2020 19:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13A4B20C09 for ; Tue, 8 Sep 2020 19:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599592734; bh=PvPPG3nMBDVF9kyjupiA0DfWma9fnhZtAJj0a4ZnnTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xiOz4xsvpkGWd9p8PNGlA+QRR55/bRkdBJiWpYkXROIAgj4lMEGxL15f+mwk4iFFT oEak+pO5u8J1qBCvOwMSw/SQ1NkESRx3Skr54F1QfPtb2GPoxO2E8r974Z+IW3kqUX cKO1t7/prJfubSToD3IqWm5DaMc0F535SlF5dOmQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731604AbgIHTSv (ORCPT ); Tue, 8 Sep 2020 15:18:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:52180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731137AbgIHQCv (ORCPT ); Tue, 8 Sep 2020 12:02:51 -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 B65EE2419B; Tue, 8 Sep 2020 15:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579534; bh=PvPPG3nMBDVF9kyjupiA0DfWma9fnhZtAJj0a4ZnnTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bvUoAUgz2c5/riLh12k8uGqPu/RTlUjbeepWVjfPn0+vfINrC05FlVVgYeK8reCAX jitXCN5IJi/LdxN6UBxAjXqaq13/ywYI9KMqiI5zoi/q1vn3vl0x5uiMLHQ4n0KDqo ifbFEpT6DxIhI4SXyGVz2UchzobwOwwBf2saPjJI= 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.8 118/186] tracing/kprobes, x86/ptrace: Fix regs argument order for i386 Date: Tue, 8 Sep 2020 17:24:20 +0200 Message-Id: <20200908152247.355631145@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152241.646390211@linuxfoundation.org> References: <20200908152241.646390211@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 @@ -322,8 +322,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),