Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1370904imi; Sat, 23 Jul 2022 03:58:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tUz5R+ZTnN9lrKcU3PSowSuw+kPR1rX3FTt+nWg64sAaTqOJD6sHkrDWvFEB6KmVpjz/p0 X-Received: by 2002:a17:90a:514b:b0:1f2:2b47:5404 with SMTP id k11-20020a17090a514b00b001f22b475404mr15147826pjm.143.1658573933617; Sat, 23 Jul 2022 03:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658573933; cv=none; d=google.com; s=arc-20160816; b=c5HVsG79Q4tCxle4RdamDXqSFZhaP57JZtQfcsA8HHxgmXJ2tLakbNMnfSKbH3Fh3D AgXvty8OFMs8vuO0Qf7togXpSbdxukh1fRjpiBGd2mdThtNDarRhRmnIRwE+CX1x63zU BwBBZVGDtC1RPmqJrgcMJGx8Xm4RI8gj1rOQlS1BG27cc219Y2sDqthQLrl+G1Cg3/F2 AaWpIZXjmbmCVeTNFxQzeaVUU9lrFSBhKTa0dWJsUsTFxNFrifoKq2uXOdrR5tVBCZcd gKixy2ZkArmkjou3PvVWOBdvCxkusqfpURx0WwZpWsTFXLg1k6+3+yCP/roOBj8pdTxa yn5Q== 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=neAPEarjiV6yG1Ln+EJIEeIkm95PNY+RDnt6e5bvOUg=; b=MlICjrOHqCrr0409QWPIY8OgxLlRIEWxQ/XOhdssasBSo1dY0B+G6/iQ3kW8ZTqRrN tLnCpCxB+Zdk4clcH6pjgFPGJrCrGOPtSTVZkcmylOJJyGMueWyLyr1TjpI5rnZ/1sUw 7HpBDbH5AYfA5CEJJVOektdHZN//kdyMDff/jRptw2LDJq8t1b952V4AOwcdT7DNLMu2 56OTGe8y9YB6/HPDrxHMhkYWJgN3a3ras76/vyxLPrM6MOONYZ4S27VyLkWQMfREOwcp kxIFvoHX0SypQZuvWJbXuc+hL5hKM8kW+3zV5oVe/4VmJ2D0dTYXl8ysSGY7YbfrkEUT h9Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LYfYDShH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay8-20020a1709028b8800b0016c192735f1si7481312plb.220.2022.07.23.03.58.39; Sat, 23 Jul 2022 03:58:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LYfYDShH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S237588AbiGWJ5i (ORCPT + 99 others); Sat, 23 Jul 2022 05:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237430AbiGWJ5M (ORCPT ); Sat, 23 Jul 2022 05:57:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF7313D58B; Sat, 23 Jul 2022 02:56:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CC0F6117F; Sat, 23 Jul 2022 09:56:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B53BC341C0; Sat, 23 Jul 2022 09:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658570217; bh=aXeY+HDy7y5ZCMPBdTis/j+MlUbP49bXjsG5jcTgf60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYfYDShHpoxkeJr26r9iGae+ilT0KKixbkijnsFhx3VGPrGOL1+UM3STHOlonFdlC UgI8ie35BA4udq0vnvZkj0s9A19RuE1esLP8hkb78YyiflbIQwkj17QCQE9bqXl+d+ q2MRXsztNv+o1e+/8xmU1lsqco3S3xXDGqqsl1L0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Hutchings Subject: [PATCH 5.10 020/148] x86: Add insn_decode_kernel() Date: Sat, 23 Jul 2022 11:53:52 +0200 Message-Id: <20220723095230.124860988@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220723095224.302504400@linuxfoundation.org> References: <20220723095224.302504400@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Hutchings This was done by commit 52fa82c21f64e900a72437269a5cc9e0034b424e upstream, but this backport avoids changing all callers of the old decoder API. Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/insn.h | 2 ++ arch/x86/kernel/alternative.c | 2 +- tools/arch/x86/include/asm/insn.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) --- a/arch/x86/include/asm/insn.h +++ b/arch/x86/include/asm/insn.h @@ -105,6 +105,8 @@ enum insn_mode { extern int insn_decode(struct insn *insn, const void *kaddr, int buf_len, enum insn_mode m); +#define insn_decode_kernel(_insn, _ptr) insn_decode((_insn), (_ptr), MAX_INSN_SIZE, INSN_MODE_KERN) + /* Attribute will be determined after getting ModRM (for opcode groups) */ static inline void insn_get_attribute(struct insn *insn) { --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1290,7 +1290,7 @@ static void text_poke_loc_init(struct te if (!emulate) emulate = opcode; - ret = insn_decode(&insn, emulate, MAX_INSN_SIZE, INSN_MODE_KERN); + ret = insn_decode_kernel(&insn, emulate); BUG_ON(ret < 0); BUG_ON(len != insn.length); --- a/tools/arch/x86/include/asm/insn.h +++ b/tools/arch/x86/include/asm/insn.h @@ -105,6 +105,8 @@ enum insn_mode { extern int insn_decode(struct insn *insn, const void *kaddr, int buf_len, enum insn_mode m); +#define insn_decode_kernel(_insn, _ptr) insn_decode((_insn), (_ptr), MAX_INSN_SIZE, INSN_MODE_KERN) + /* Attribute will be determined after getting ModRM (for opcode groups) */ static inline void insn_get_attribute(struct insn *insn) {