Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7425495rwl; Fri, 30 Dec 2022 08:16:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXvC4lLZAUiPML0q4DvMRl+GBoDWFIC6vasWy2Kq9FGioZFCCAHAU3KPyHTtUYQ4XlJ0K1UX X-Received: by 2002:a05:6a20:289f:b0:af:d0d7:9f38 with SMTP id q31-20020a056a20289f00b000afd0d79f38mr35696956pzf.2.1672417015115; Fri, 30 Dec 2022 08:16:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672417015; cv=none; d=google.com; s=arc-20160816; b=sSpUpeYgx54AaXuaxRsSN45cz8UBHbx6ZSJUv9U9kpy0quo+XueVBNzdPZr0m3GOKc 7TvF3+YwBIZXjnjFxg9liSGYU/6nhLaZ6PX2xhazqzSRp/YqJMwfAJaItLy1tNm0rshH P7fox+sbppsliOPuYZqs6Ff8QnifcjId1jH9VD8lWjF8RjYCAtTwahF9AN95RbYZbSKQ SY3+kcx7R30KQYvZ7oLj7qKNTzZYGgGB3xdIZNW0RnpSBReDf/GshaptTo9TO/RiCAHV VlmZvxwBJYPF57QbaWS30irEKWFQl9YcpZ49ocq9l1qcFLv/AVtZB4LmzRDVZZZIPXi4 FDHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BxfkqOG1X9KuqUurA2SWp45MzpX2tzl76AOrYBX8vQ0=; b=WobImcccDsySardA5ph3kRlIJ5o1esgPnFjekYNgPpgieaA3qPFw2TAbsRCuSUj6Bq a3oDAxq9aLfbrfrct0SzXPOybvY0IMtLFqyng245pQdd51DUaxDU8S5pNXk0kJqeyaNG ls/ppJst1vKy4n4w1yaK5Hca3VU7p2ta/F694wGYSud1n3PKn960R4NSuyEkArLH4vlv zEJNbWdiQ6fDcFUmEel7WhZ6nXEAw/3PYLSF8bP/XAO7dMVR+YGQCDFtASGluVtPaDK5 Q/4tlQA2lblyDz4u3ISk4jPBkql0jbrsc8IdLa8bgW2oSfiYRPV8X+pkmVEn67cbnJhB 1CLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=cthGg0NM; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a63d446000000b004780e2b6fc6si22438321pgj.626.2022.12.30.08.16.46; Fri, 30 Dec 2022 08:16:55 -0800 (PST) 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=@zx2c4.com header.s=20210105 header.b=cthGg0NM; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235108AbiL3Pyq (ORCPT + 63 others); Fri, 30 Dec 2022 10:54:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiL3Pyn (ORCPT ); Fri, 30 Dec 2022 10:54:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1583E178BE for ; Fri, 30 Dec 2022 07:54:43 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id BF544B81CC2 for ; Fri, 30 Dec 2022 15:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 368B7C433D2; Fri, 30 Dec 2022 15:54:39 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="cthGg0NM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1672415676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BxfkqOG1X9KuqUurA2SWp45MzpX2tzl76AOrYBX8vQ0=; b=cthGg0NM0dVWdKvV1zp+jB5rca47a21IO6n3zxLLzOp65JWqNPbQJNl3WrtYsGIT0TEPPN TorQyQeFPOUl9l7L9+CP2bIPR07oP181k7iAQDPwvaZ4N5oBMkcWM641IcoE9QcEecKgFu 0vJZQPICKmJERWhDOqV+okWpoUilnf8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 2838488f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 30 Dec 2022 15:54:35 +0000 (UTC) Date: Fri, 30 Dec 2022 16:54:27 +0100 From: "Jason A. Donenfeld" To: Borislav Petkov Cc: "H. Peter Anvin" , pbonzini@redhat.com, ebiggers@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, ardb@kernel.org, kraxel@redhat.com, philmd@linaro.org Subject: Re: [PATCH qemu] x86: don't let decompressed kernel image clobber setup_data Message-ID: References: <20221228143831.396245-1-Jason@zx2c4.com> <6cab26b5-06ae-468d-ac79-ecdecb86ef07@linaro.org> <9188EEE9-2759-4389-B39E-0FEBBA3FA57D@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 On Thu, Dec 29, 2022 at 01:47:49PM +0100, Borislav Petkov wrote: > On Wed, Dec 28, 2022 at 11:31:34PM -0800, H. Peter Anvin wrote: > > As far as a crash... that sounds like a big and a pretty serious one at that. > > > > Could you let me know what kernel you are using and how *exactly* you are booting it? > > Right, with CONFIG_X86_VERBOSE_BOOTUP=y in a guest here, it says: > > early console in extract_kernel > input_data: 0x000000000be073a8 > input_len: 0x00000000008cfc43 > output: 0x0000000001000000 > output_len: 0x000000000b600a98 > kernel_total_size: 0x000000000ac26000 > needed_size: 0x000000000b800000 > trampoline_32bit: 0x000000000009d000 > > so that's a ~9M kernel which gets decompressed at 0x1000000 and the > output len is, what, ~180M which looks like plenty to me... I think you might have misunderstood the thread. First, to reproduce the bug that this patch fixes, you need a kernel with a compressed size of around 16 megs, not 9. Secondly, that crash is well understood and doesn't need to be reproduced; this patch fixes it. Rather, the question now is how to improve this patch to remove the 62 meg limit. I'll follow up with hpa's request for reproduction info. Jason