Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5158imw; Tue, 12 Jul 2022 13:24:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1skTME3zCns3MOqVsOms//NFs356QkT2760X+NmaJyQBgs2oInZViJYNkZNKsq3hFf0KVpS X-Received: by 2002:a05:6402:50d4:b0:43a:d2a9:29ad with SMTP id h20-20020a05640250d400b0043ad2a929admr18201287edb.336.1657656902154; Tue, 12 Jul 2022 13:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657656902; cv=none; d=google.com; s=arc-20160816; b=HbAbAeYcAMg4VyWhLb4q8TVMa/ahViHmUDdWIbngac0wbJBGMMJjgEPhjb3f3TfvX5 svSM84BDz7frsvZZ2E3IhcmG/+Z1tIcDq0yCVPCV8HaIMhn/CVLuk1O9bzA+1IHEb98h DHwDpW/FhiIx40Tc3X+kS/ZlDFtq5Xcf5+zzfFhP7iVx2i21Sn5VbjG1oqQSRztV7/9e +kLivqsDrz9eyZnvjG61gYm+dsmJTtZAm/UzTrjvCndCHp9UUjJUFrfKSUnlPwGuRfiF QYyX37qLew+ZDwlaxJXdHm+v1S33xCtuCSvyuvVsKICuYykNq07+oU8LojguHfXZkGyX U1zQ== 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=lpakyZQE53bTWVRr3LjP6LpOozDnkGo6A5ePTXSNm9+/xEcNP3Pxdn4X4EA1cXWD/g 5MoeF5wSaLPGdmZoJJzwSrqyylwawePLjey5/s+6zMrGnhnbkAjVI1e6rMjCGnb4Ym8n I7gCpbJm5tJMrVbxATYSk9rZRxGnwZvId+taYQ3iM4MKMdTJpyG3qpaTtcdi72ZvY9uf E2mzfiWgK9BPzcbi/cxvhuCJeuBgU+zP4UWZYm+9Xh7LI65RuYrdwuDU0DPIRAY+yB98 OY2WpFWTG7kCzFZ0fQ0GB9S0n0I7QGvL42iy25Cc3rbWkrbOgLDB9XYKjNv35KLn/hgQ pzpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EoYwEs7y; 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 p13-20020a17090628cd00b00726b8e79284si13494136ejd.763.2022.07.12.13.14.17; Tue, 12 Jul 2022 13:15:02 -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=EoYwEs7y; 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 S233916AbiGLSlh (ORCPT + 99 others); Tue, 12 Jul 2022 14:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233904AbiGLSlE (ORCPT ); Tue, 12 Jul 2022 14:41:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A44ADD6CCF; Tue, 12 Jul 2022 11:40:52 -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 201F961AD1; Tue, 12 Jul 2022 18:40:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C7C7C341D3; Tue, 12 Jul 2022 18:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657651251; bh=aXeY+HDy7y5ZCMPBdTis/j+MlUbP49bXjsG5jcTgf60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EoYwEs7yUZNBztLTokrlQT3MOHwA9K5HsJO7G9eKqmUIwX6aRu9Ht5z4IDBilVWi2 uMTi6EnIgyAVc0Jr0KeJemfxYzw5ZoIXaCjm1Z4fh6iihhrK5flCvkLT9bNs8L078n s7lZaNZtgCF1l+r6+PNisirKu6+N3nl7rBWdG/0A= 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/130] x86: Add insn_decode_kernel() Date: Tue, 12 Jul 2022 20:37:46 +0200 Message-Id: <20220712183247.336409002@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712183246.394947160@linuxfoundation.org> References: <20220712183246.394947160@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.7 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,T_SCC_BODY_TEXT_LINE 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) {