Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10273671rwl; Sun, 1 Jan 2023 22:42:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvEpFZDI+SfXJ/8W8rym8Q24EUrybfo+JN0pZe0ydc/qB6JSL5q6OXfrnFqG2FEqgbkfj1h X-Received: by 2002:a17:907:20b0:b0:7d3:8159:f361 with SMTP id pw16-20020a17090720b000b007d38159f361mr34600362ejb.36.1672641757366; Sun, 01 Jan 2023 22:42:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672641757; cv=none; d=google.com; s=arc-20160816; b=k+NaJ16lb8sEbC0JF6vX6nYJH/kv9/D/jZ7/UbhJX26u5I8cHPy3voqGm9ACHWdMdg 6VIU9kTzGqFDnga9Smw0ngGiX1mVpw5Ekj/Q/DqPy6SqAENia7XBHCJkmbovwNv+B9S0 Tx4zIKw/AadlGv97onsDZbPW9lrwWVfcFz4mlEk3fpZpeDY+EaFp/+U5ZK/s+FX77x8p uDQoH1DRVQ0UA03FN0Quk+4IIuKSUAMsAYyKitwqOqYUOARXqziCKqJAz5TFBJkMjEdG UYWA8DAU0pHOzYPRFtLN/0/RYKuf3KTZT6TAUO61InYDJjnHe5hLdNsH1RGJHnv56pYg KGPA== 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=A5h3QieuYYzDOmoQcc1jOMq8HxvyiZWavNMk7yqAE4w=; b=QBwJqxUtXXnospZa+M8Le0mXlYA49NEM2in1IaTjaeAS5gnPHpeBhAX8M6EaA0ds4u 2D5v1gTNyr5p1yfO8ABERHtT1SvFRmLkQp326L2O00lCUMOVO2TwisSZGCDTTze0mq7k 7/P/kZa/0n5mIxpJvQge4BnTzEewKI99CaDF6AsyrRkmc2Jj3rsPajLH3D20u+dV06Wt v529MC+lcKyZ/RmJG8zrhHutWnKKWKCLQghVwiEKK7qLIyZ01HS2dONfIeikuDf8WMUC +F9EuRs4NnxHsGIXclkBJAnKEf/7fSXw5kr8RT0dzp6YhyurS19apmhhbqoC8Hqar+F1 nRrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=RGoSnp0e; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js4-20020a17090797c400b007acdb4016e0si24034783ejc.224.2023.01.01.22.42.23; Sun, 01 Jan 2023 22:42:37 -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=@alien8.de header.s=dkim header.b=RGoSnp0e; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbjABGCN (ORCPT + 59 others); Mon, 2 Jan 2023 01:02:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbjABGCK (ORCPT ); Mon, 2 Jan 2023 01:02:10 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF53CBF6 for ; Sun, 1 Jan 2023 22:02:09 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 471CD1EC0589; Mon, 2 Jan 2023 07:02:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1672639328; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=A5h3QieuYYzDOmoQcc1jOMq8HxvyiZWavNMk7yqAE4w=; b=RGoSnp0eXlRVYUC0SrfE1xiexYKt8xMKCv/nkL6NNJdjh3UGoyqOFoIzZ++A4AWOFbsQqd Ze5d8AOzno/wRzFC18rPxdTZ4NUxtZETYjXbgO7n7wLn9qFPUdHIB4hbiZY/cy7Ms8Ikx8 nA0eG4icJt5H2GjDtnDw56Tj5xJ2wYI= Date: Mon, 2 Jan 2023 07:01:50 +0100 From: Borislav Petkov To: "H. Peter Anvin" Cc: "Jason A. Donenfeld" , 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: <46466e54-25c3-3194-8546-a57cd4a80d9d@zytor.com> <60566f8b-c90f-12e7-c13e-94e9829eee2d@zytor.com> <8f072588-7d66-0932-7486-ed9159ae93ae@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <8f072588-7d66-0932-7486-ed9159ae93ae@zytor.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Sat, Dec 31, 2022 at 07:31:21PM -0800, H. Peter Anvin wrote: > It would probably be a good idea to add a "maximum physical address for > initrd/setup_data/cmdline" field to struct kernel_info, though. It appears > right now that those fields are being identity-mapped in the decompressor, > and that means that if 48-bit addressing is used, physical memory may extend > past the addressable range. Yeah, we will probably need that too. Btw, looka here - it can't get any more obvious than that after dumping setup_data too: early console in setup code early console in extract_kernel input_data: 0x00000000040f92bf input_len: 0x0000000000f1c325 output: 0x0000000001000000 output_len: 0x0000000003c5e7d8 kernel_total_size: 0x0000000004428000 needed_size: 0x0000000004600000 boot_params->hdr.setup_data: 0x00000000010203b0 trampoline_32bit: 0x000000000009d000 Decompressing Linux... Parsing ELF... done. Booting the kernel. Aligning them vertically: output: 0x0000000001000000 output_len: 0x0000000003c5e7d8 kernel_total_size: 0x0000000004428000 needed_size: 0x0000000004600000 boot_params->hdr.setup_data: 0x00000000010203b0 -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette