Received: by 10.213.65.68 with SMTP id h4csp2119300imn; Sun, 8 Apr 2018 20:10:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx48AodvbxVqL8y8eLBOTR/A4kq7CN+zFxVsMQE6xkSCuietaDh6tPHs6PrPu7CvOpSzUy5MM X-Received: by 10.98.7.152 with SMTP id 24mr23070109pfh.94.1523243376394; Sun, 08 Apr 2018 20:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243376; cv=none; d=google.com; s=arc-20160816; b=MKNxrWhlKyQwSlM7NMC2Dn/5DMUTBw8JupNLA46dnHpiBw3YKd0XvouOrXg8OXmOAN k1fwXmRsYxutQi0Wyc5sAQGGjTeZQaPIrc1hOrQw+qTB+aN9jcBwdlSA5+a+V1ziYMBS Z7jgnC1NYUNy7sdW8YL6U8qTC+qw/xhWrqz5Ne2qJZsx+JdcFhSh7hIV8Xr/auDGccTb ZDPXodlY0BEsLkifkjm6bkN/WGpUTYDZJ+NYs0SjT0EQiFbcdMx5/JTolwLKCpuDbPf0 d3EC7dLJtLbrbGl24rVl2GkJYV+NUFxFw6yKUgReTP/d9uOjnMWZO0QCJe6pTlGTDftr e7PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=87RKQJ7sPrFs5uM8CuiE/7Em3Rdv4FmUycAm3Od3D4E=; b=VNwssCJ8zNg8Y9ZsYiWwm2uZCbtezMXt0gUI3uxLHOCUZCl3BnXJngf3uXm/F1JcYe akxFuWI5jUih1+IM9KkFmgG8XFOf5ufbMh+tX/qCSBLDbdQwYD2fMpcLLHv/F+BIYmLT 5IQWfvj+5gAETd6p5ICsqSCGr1JMAB+SqZMee1oGDJyO2qw6wuxuDJBxmtgNmGL2V9qm ByQeANccOp4ho80Z1O6bitH0PeJuxwAG+/sg1g3tnMSMZZlf+5e/7xV05bHXllG8pgWB MyjScNBhRVr/li/6uigdPapn+w/b6rW0mo/5pUbs7piKt1GtY28cliWOlVXg70QQf/zk Ddpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=iayCRrUY; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r29si10486474pgn.386.2018.04.08.20.08.59; Sun, 08 Apr 2018 20:09:36 -0700 (PDT) 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=@microsoft.com header.s=selector1 header.b=iayCRrUY; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932230AbeDICic (ORCPT + 99 others); Sun, 8 Apr 2018 22:38:32 -0400 Received: from mail-cys01nam02on0094.outbound.protection.outlook.com ([104.47.37.94]:22752 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755453AbeDIA1a (ORCPT ); Sun, 8 Apr 2018 20:27:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=87RKQJ7sPrFs5uM8CuiE/7Em3Rdv4FmUycAm3Od3D4E=; b=iayCRrUY6NEmyXHO/k6PTg2il1JTRkdmLy63oDxqvFXtazugkj+AJZC5Fqtyc7YaSVdWRbrE9U7y97+/x+GTEk5WfE+6hu/wnjCnricx6B9erkaBYfHlZUgUsXkZO9SOT14riGyxs2zinFVp8Pk0Oywc6GF84rg3BWpVIazcpUM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:27:24 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:27:24 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Bob Moore , Lv Zheng , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 042/293] ACPICA: Disassembler: Abort on an invalid/unknown AML opcode Thread-Topic: [PATCH AUTOSEL for 4.9 042/293] ACPICA: Disassembler: Abort on an invalid/unknown AML opcode Thread-Index: AQHTz5j3YGrru3HpwEayF524f6lgWA== Date: Mon, 9 Apr 2018 00:23:22 +0000 Message-ID: <20180409002239.163177-42-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1031;7:5pr6+slrhmgAaUGpscs/ND9+queaw5Vnfx722h9+n6mg3tKVBo8QBmd+opKr5BBBj+PvCCDC7tMIKcZcf2gV5awvoo3OXhDSB6zCAbvfU8Rnt4gM1G8zImxlr9Wuy4S1dE4rX3RifTB5nvMztrtSH1fi8FLPklnUue3DxrKvdi916lzi9d2tLCzoCGZsbuOLkghDp6KQky1yLfm7W8G2KfbxSSQe4cUSqke1Tn5Tb6jE4JfY8C+p6jzpm+5Gm5u4;20:yfFea5dZQPmEpdIJ1OtEujegk5hJLe+dV7q5tz1DFxr2qUBmJVHHGiW/x26iwL10wlIlKmrt7eIyYBvwx1xhfw6W/Xj4VpHwOkp7dAT2L+3QWO2jRwkXvnASu0dgzSrIkLpZ7NhRaENdrR5h8XFA5+NWHZXP84BW/cy0R/kYric= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 9938760d-e59e-4cf4-04f1-08d59db0aa69 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(166708455590820)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1031;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1031; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(39380400002)(346002)(39860400002)(189003)(199004)(2900100001)(10290500003)(99286004)(76176011)(14454004)(966005)(7736002)(11346002)(26005)(86612001)(72206003)(478600001)(36756003)(106356001)(66066001)(2616005)(186003)(575784001)(22452003)(86362001)(68736007)(305945005)(54906003)(102836004)(486006)(59450400001)(110136005)(316002)(6506007)(446003)(107886003)(53936002)(4326008)(105586002)(6306002)(6436002)(6486002)(476003)(6512007)(5660300001)(5250100002)(25786009)(3846002)(6116002)(1076002)(97736004)(3280700002)(2501003)(2906002)(81156014)(8676002)(10090500001)(81166006)(8936002)(3660700001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1031;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: RtWsvQr1KX5Fo6ST1GgjUWdkxnLW0JnUQc9rWsd5KMPy8ZdTfdcgJ+LesAYaEG+mIWZTMSbyWn8rHys2tHTMfmTiIMcHcdayEJcHaGUNYiaiB16QzVl4bU5K+BPWI0+SFGm45jhe1XuLxLM0g6wJu/0/evcs23FWHd6xnlS4o1+rQM5Kh7GHsNjk85XVZq+9hyY/eC/xJN8hJudJTbUpChpjbn9zrJmIdsNg6r15sxsNVbL1d+DYxFSLIrlvSCqic4EiGf6+0BlSTtAgrMNSix2xI8B3HZNxBMUX0TrlpdA0pZrrGDrMwEr0jaI46XDhDO1eB9mK6oVBQThGpxqqPuI0x9CltbAl+bxtgC6oBQv3TV92X0qEgqqsUevgrwChcM0svfjln8WhaXi1DGQ4G9bv7g6FN+l4ManrLzeThM0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9938760d-e59e-4cf4-04f1-08d59db0aa69 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:22.6905 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bob Moore [ Upstream commit 6f0527b77d9e0129dd8e50945b0d610ed943d6b2 ] ACPICA commit ed0389cb11a61e63c568ac1f67948fc6a7bd1aeb An invalid opcode indicates something seriously wrong with the input AML file. The AML parser is immediately confused and lost, causing the resulting parse tree to be ill-formed. The actual disassembly can then cause numerous unrelated errors and faults. This change aborts the disassembly upon discovery of such an opcode during the AML parse phase. Link: https://github.com/acpica/acpica/commit/ed0389cb Signed-off-by: Bob Moore Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpica/psobject.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.= c index db0e90342e82..ac2e8dfdf74e 100644 --- a/drivers/acpi/acpica/psobject.c +++ b/drivers/acpi/acpica/psobject.c @@ -121,6 +121,9 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_w= alk_state *walk_state) (u32)(aml_offset + sizeof(struct acpi_table_header))); =20 + ACPI_ERROR((AE_INFO, + "Aborting disassembly, AML byte code is corrupt")); + /* Dump the context surrounding the invalid opcode */ =20 acpi_ut_dump_buffer(((u8 *)walk_state->parser_state. @@ -129,6 +132,14 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_= walk_state *walk_state) sizeof(struct acpi_table_header) - 16)); acpi_os_printf(" */\n"); + + /* + * Just abort the disassembly, cannot continue because the + * parser is essentially lost. The disassembler can then + * randomly fail because an ill-constructed parse tree + * can result. + */ + return_ACPI_STATUS(AE_AML_BAD_OPCODE); #endif } =20 @@ -293,6 +304,9 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state, if (status =3D=3D AE_CTRL_PARSE_CONTINUE) { return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); } + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } =20 /* Create Op structure and append to parent's argument list */ =20 --=20 2.15.1