Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1595665ybv; Thu, 20 Feb 2020 23:59:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxnE11BTT0nsx/tE9aIqsXyqt8XFky0aFrZo4oz5ZlE5O0+56gy1xxO0T1FZM4GdN2vq1pf X-Received: by 2002:aca:44c1:: with SMTP id r184mr878555oia.151.1582271958249; Thu, 20 Feb 2020 23:59:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582271958; cv=none; d=google.com; s=arc-20160816; b=y0BwRMiTRybhl/bnF5PdRR1EI5j28TUKyRR9n6l9xIGYemuo5fktil/MKcH57dfMuX +tP+XjqUgxklPPTRZa6plt9rGDc8cyJqPwPVg4nLVdG5vlomBg6wEQcxzLESFEAFpqT5 ZsOA8g3l08L8duEafVY/IlCGkN53alXQz6eO+nZJkyV1Zk9YCGyZDkBq9ffIBo+5Qe+Z Zv+kCc8vu4oZd+0EJJWQgU8oZE8PNig6+3WY6JlwRe5kY64XFndK45jWawEygRo86g19 ingg/mr/YytEY6hwMIAbxB0PXAxIHavCQt7DZTnw0fbkPJb+xM86Hukzi3iBI/9AS4Yb +SgQ== 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=voqJLTSqJFVrYl/ceaTKObGL643PVkcsKw6SXmWm070=; b=px7SaMJ2Cw9HPDgDFLGha9Zpn0QHaSEhnpk6vSKq6g3r9qpKY8KahLf0qd7KLYaEKi eM5svB2b6pCFeA4GYL6svWE8fKVkHlxFTdu1rBGEPPjtrUDoqFoxLrOEZwAA9WCVIewh 3Aj20E1KrtHuuVkobOCnFyo+EnS7E0m+RSk0EIpLYVeppgbojDoWKxTyCieX/x338H09 KqUnGNLl/0ptPJLwFP0Ga71hMlI2mEXg1Twr39xGmIalzwtAIo5LZNI2ZBfYfncJFLQG 1eLmvp4XG6N7512sutEWq9F9xR0B9LsH2Q9a1NiDk4VBw4ZxDtbeM7I0jLCYaAp6fr09 MFbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2ja4hluJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u123si443873oif.84.2020.02.20.23.59.06; Thu, 20 Feb 2020 23:59:18 -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=2ja4hluJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730713AbgBUH7D (ORCPT + 99 others); Fri, 21 Feb 2020 02:59:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:58962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730846AbgBUH67 (ORCPT ); Fri, 21 Feb 2020 02:58:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 78D6120801; Fri, 21 Feb 2020 07:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271938; bh=qbbsCdrsrCkGn7EAbzaWAaGMdfYyj4oFCK63U/FyJN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ja4hluJ1yMKpLy54WFMb1m0SOhAJ0S3XMnIRBX/HjGqkWDrZBaIAE+kdNiqj/Cq9 +jlPGHVHh2+QYbjhqUbna2Z2zr9G6s5pAzyeYAIBEWXEngyQu8jW4bvHz7/wml6rfA Bx9yr6r0rLNpvYuI2xC9Q5hSzMPlVNeaI0mbcHFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Masami Hiramatsu , Borislav Petkov , Sasha Levin Subject: [PATCH 5.5 318/399] x86/decoder: Add TEST opcode to Group3-2 Date: Fri, 21 Feb 2020 08:40:43 +0100 Message-Id: <20200221072432.307935759@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@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: 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/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 8908c58bd6cd2..53adc1762ec08 100644 --- a/arch/x86/lib/x86-opcode-map.txt +++ b/arch/x86/lib/x86-opcode-map.txt @@ -929,7 +929,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/arch/x86/lib/x86-opcode-map.txt b/tools/arch/x86/lib/x86-opcode-map.txt index 8908c58bd6cd2..53adc1762ec08 100644 --- a/tools/arch/x86/lib/x86-opcode-map.txt +++ b/tools/arch/x86/lib/x86-opcode-map.txt @@ -929,7 +929,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