Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1944638ybv; Fri, 14 Feb 2020 08:38:59 -0800 (PST) X-Google-Smtp-Source: APXvYqw2yRZz/bkm8/vLJyCv7meY2KzzLojsTWxlxfounBqdG0235kvXROxlAxFE5zwHBEjKTJr9 X-Received: by 2002:a05:6830:154a:: with SMTP id l10mr3042014otp.44.1581698339286; Fri, 14 Feb 2020 08:38:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698339; cv=none; d=google.com; s=arc-20160816; b=gQEGixsoP1wXPA+vI2cRARc5lLey+ReTrCjNHMWqolmuiVwKzAzLSuuJ+W1B3paPdt HM8TPLr7EG99T1vaeadsNZn9nAi4/SOvyFJNyFr9A3fzOWEj1VqAhQiN1rTtuwogutG2 KDVOOZGGPCU1b++Q3d4PQ62JwGfac53qhg7icFU7Yb+N4gRb1LAz/Ry25QyqeqaUWg4Y pOgZ41Ks4aMRBvEh8AdpDMMpDe0yEBZg1+zHbU1uyLTWyqh85KBaSIRdlIvmYKLaoOYX g1FgoqObI5Smy8F0WDFQZWY6GGghyQMUwqoMC5qQfUPy0Vv7pA9raO0CCBz+dgXrjZ6k U3Hg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xZUE56pD3vc6ctQEUkZH5n18dYo85H0WWvfEYpBosYQ=; b=V0tw3i7X8t+HGNxZ/yLgvDLyLPNPfUJic80PvJd1R/OId/IdODsGPjbxNvd2g7wDMU oqrVcS19c6yCi+7sZXIuRnSMbTEwr/CDrwUGqt1Onm2hhikx02waAkYKyZZKcYHZ89kJ 2dBQW00jvh5DevTGpBWZzs5Fjwn2roqps+qcFTZszvc3FCH5i837BqtCb+PJy2PrOMbK kz24YPlRA+1gD0ybmjTj5hrYJMRr5pKV65buYztIxbJj7vAzg0qrFCDGp9o3fDizgxX5 gKfj36C1iO0k80vKSACPnthznJhtTpKZicdjldnjGqaDT4hfJqoQNtmKagqEh+6k8ySB vv0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fRNt6b6L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a194si3047370oib.227.2020.02.14.08.38.46; Fri, 14 Feb 2020 08:38:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fRNt6b6L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388744AbgBNQiG (ORCPT + 99 others); Fri, 14 Feb 2020 11:38:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:60156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405700AbgBNQXl (ORCPT ); Fri, 14 Feb 2020 11:23:41 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D39E92477D; Fri, 14 Feb 2020 16:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697420; bh=Wvyy3v03P7E1IVhVXI6dTmZh+RPcm3cg0+Jgcl5hbLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRNt6b6L3JG24tNlU9Rlhdwbf/NJPNbZa9sASQMw64f+j5Q1/H81ve3Ss46HEprML h79ZmJCx23RGb7Km57P3PkvNW24+LA643AU9x9K0iAtNMNuCw+mgXvZNM5lon5rMxy tFnXSqSK5nJMPRjzEYdPXNSJOyctdOtGJzqxnOe0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Masami Hiramatsu , Randy Dunlap , Borislav Petkov , Sasha Levin Subject: [PATCH AUTOSEL 4.9 110/141] x86/decoder: Add TEST opcode to Group3-2 Date: Fri, 14 Feb 2020 11:20:50 -0500 Message-Id: <20200214162122.19794-110-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu [ Upstream commit 8b7e20a7ba54836076ff35a28349dabea4cec48f ] Add TEST opcode to Group3-2 reg=001b as same as Group3-1 does. Commit 12a78d43de76 ("x86/decoder: Add new TEST instruction pattern") added a TEST opcode assignment to f6 XX/001/XXX (Group 3-1), but did not add f7 XX/001/XXX (Group 3-2). Actually, this TEST opcode variant (ModRM.reg /1) is not described in the Intel SDM Vol2 but in AMD64 Architecture Programmer's Manual Vol.3, Appendix A.2 Table A-6. ModRM.reg Extensions for the Primary Opcode Map. Without this fix, Randy found a warning by insn_decoder_test related to this issue as below. HOSTCC arch/x86/tools/insn_decoder_test HOSTCC arch/x86/tools/insn_sanity TEST posttest arch/x86/tools/insn_decoder_test: warning: Found an x86 instruction decoder bug, please report this. arch/x86/tools/insn_decoder_test: warning: ffffffff81000bf1: f7 0b 00 01 08 00 testl $0x80100,(%rbx) arch/x86/tools/insn_decoder_test: warning: objdump says 6 bytes, but insn_get_length() says 2 arch/x86/tools/insn_decoder_test: warning: Decoded and checked 11913894 instructions with 1 failures TEST posttest arch/x86/tools/insn_sanity: Success: decoded and checked 1000000 random instructions with 0 errors (seed:0x871ce29c) To fix this error, add the TEST opcode according to AMD64 APM Vol.3. [ bp: Massage commit message. ] Reported-by: Randy Dunlap Signed-off-by: Masami Hiramatsu Signed-off-by: Borislav Petkov Acked-by: Randy Dunlap Tested-by: Randy Dunlap Link: https://lkml.kernel.org/r/157966631413.9580.10311036595431878351.stgit@devnote2 Signed-off-by: Sasha Levin --- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/objtool/arch/x86/lib/x86-opcode-map.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt index 0f7eb4f5bdb71..82e105b284e01 100644 --- a/arch/x86/lib/x86-opcode-map.txt +++ b/arch/x86/lib/x86-opcode-map.txt @@ -909,7 +909,7 @@ EndTable GrpTable: Grp3_2 0: TEST Ev,Iz -1: +1: TEST Ev,Iz 2: NOT Ev 3: NEG Ev 4: MUL rAX,Ev diff --git a/tools/objtool/arch/x86/lib/x86-opcode-map.txt b/tools/objtool/arch/x86/lib/x86-opcode-map.txt index 0f7eb4f5bdb71..82e105b284e01 100644 --- a/tools/objtool/arch/x86/lib/x86-opcode-map.txt +++ b/tools/objtool/arch/x86/lib/x86-opcode-map.txt @@ -909,7 +909,7 @@ EndTable GrpTable: Grp3_2 0: TEST Ev,Iz -1: +1: TEST Ev,Iz 2: NOT Ev 3: NEG Ev 4: MUL rAX,Ev -- 2.20.1