Received: by 10.192.165.156 with SMTP id m28csp1065742imm; Wed, 11 Apr 2018 11:47:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+l9n4KaloNkDzURERfHOYxKlzoljAh3LxP7YViyN1cYvTfnYmDWmLjmzKjCPnrm5zP+rlI X-Received: by 10.99.117.80 with SMTP id f16mr4206505pgn.439.1523472436589; Wed, 11 Apr 2018 11:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523472436; cv=none; d=google.com; s=arc-20160816; b=T/DWunhCt3yhIAtG3tpWoccG345vuBFKj5XBDDpPUlQ6O+JhXzFZNr9I9AzD2DCKnf yyzIZ/b2sLxvCp7QVDoA32w+E7X418sp7O0+4YjcbGs5ECAGFpQ2HL33YExrtyQPcyna 9uaEwUTT0tcF12+UAymC6GvRZBgLQyGPYA4UnkdUHmRYrT+ztGYfEasum452NDfPi5Bi Qptt8RNQ6rLQcN0OnMY7jmijTun4cxNtuxrmsmClIyZcG2WT91Qiwti8XyERaplo58EU x+xDo9zilTpBXL6XWTb7Y3X+VanWJbA2fKhhE0BxGs8bHBajsw1AG2S7HEOWz92Wb/9b kFZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KYlAfLLgT2o4gQkYt2QevtcH3uxdXVjohKxA/J6EYeA=; b=aE8u1obo/iwzsR2Lo8sU8a0i77c/t7whItWvI1sn4+oNuVzEGHrgBKOtOny5qB3PBi 1cci6O9jEyf8tIGlVLO+ZAYwa4yN5tRAobCGeQRxMjov1irAlEMX1NFcAudWyg1SDOEm bv9VC4Fa0qx4YTJ+ny4wEG+33ycsRPl0GbL7dJB7aSUxAglwPx/XSf7LouzfVOZzwgNf eY3fJEKP8aBe95cb/8sc5OfL4seiP/B0b2HDEw0prFKZ3EFtoTJ0V1F4neD+Tl/+rWDE Z9YfqNE5ZgHY9On6q94Us+JT0zJBNObN0xPUK0vj0ECqIUrQ/bSDYtNpqAJMYFxQYS0q x/Iw== ARC-Authentication-Results: i=1; mx.google.com; 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 m14si1280221pfk.201.2018.04.11.11.46.36; Wed, 11 Apr 2018 11:47:16 -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; 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 S1755287AbeDKSnU (ORCPT + 99 others); Wed, 11 Apr 2018 14:43:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57504 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755274AbeDKSnS (ORCPT ); Wed, 11 Apr 2018 14:43:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 66B16E9B; Wed, 11 Apr 2018 18:43:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Moore , Lv Zheng , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 3.18 088/121] ACPICA: Disassembler: Abort on an invalid/unknown AML opcode Date: Wed, 11 Apr 2018 20:36:31 +0200 Message-Id: <20180411183501.827412320@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183456.195010921@linuxfoundation.org> References: <20180411183456.195010921@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpica/psobject.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/drivers/acpi/acpica/psobject.c +++ b/drivers/acpi/acpica/psobject.c @@ -118,6 +118,9 @@ static acpi_status acpi_ps_get_aml_opcod (u32)(walk_state->aml_offset + sizeof(struct acpi_table_header))); + ACPI_ERROR((AE_INFO, + "Aborting disassembly, AML byte code is corrupt")); + /* Dump the context surrounding the invalid opcode */ acpi_ut_dump_buffer(((u8 *)walk_state->parser_state. @@ -126,6 +129,14 @@ static acpi_status acpi_ps_get_aml_opcod 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 } @@ -290,6 +301,9 @@ acpi_ps_create_op(struct acpi_walk_state if (status == AE_CTRL_PARSE_CONTINUE) { return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); } + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } /* Create Op structure and append to parent's argument list */