Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9172175rwl; Sat, 31 Dec 2022 21:08:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXs2aDhyRzmxMlwl3z9bg6BPFP7zS5aENAqlQulLeCjfC/4QtPmDeEf9JegH6KNOcmW0wiGC X-Received: by 2002:aa7:db53:0:b0:479:973d:8672 with SMTP id n19-20020aa7db53000000b00479973d8672mr31202115edt.3.1672549710281; Sat, 31 Dec 2022 21:08:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672549710; cv=none; d=google.com; s=arc-20160816; b=nr9cJ1ImMtsnZcrf4cp4hHw+4bbzlDt5BrWSf5TmLEnqzWERu67B7TQnhZCzLnV9MV rkOdsMRFps+iu2nFmVUnRxL9Um7gBDPlyqclZ7L9wquEptb8uV3WAhB6d9LwkxSjAjEm hc6FgcTAm4+O9p8oyRwWe9EtaGKubVH+Fq2Wf0OEp+AWXRkncC3sWxAoZYUiBD9KQP9F l+Ut3ASj+5ndTcUUQsvD8NLpZ2++EQ7Fm1rUFuf37/41gtsal5dB+fY4K6bEF0PdMewW 56605YMYZKxwLk55gMN0nDjwEVVACtadnBRPA/TeSOImrIg2cxdE3YprxSEYiDzmbWa/ Jeng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-filter; bh=VpwZJfHjUoFCQG04147cJw1T6GjsP7kTmWFVBOMEzis=; b=k5Meb4im6KfKQet6QDVC8J4FD4SMZt4QokkjNSKf4xiGwQ3KwMmP2icHYnlMp8CW9V fUfAqZ9s0X9VNnrPHTNu9sIorNRO01YF0V318QTC8eSRJLiP6Q6Y7WgHIjuPes9R8+Jg orZQeNee9f7UTU1mTGMgvlpyufv1qzOiclrXrf01GiycwEB/sa9HKJyQCdR/+3plMr73 lnJyS1rOGyiYGxOjjPUr5obL6R8kPnSrGmfd0BCJhkGjvXOf16IWh3hhVw3iZkYIW8Bp BbcYhDTJqbkOYf0HLoqq2EEt99hetVWDSxg84kvhwmA5u/0gw2aO+QIEEbC6KOkR5Y+D JVjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2022120601 header.b=FBj19I80; 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=zytor.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a056402279100b0046dd7c3ceb5si22370387ede.475.2022.12.31.21.08.15; Sat, 31 Dec 2022 21:08:30 -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=@zytor.com header.s=2022120601 header.b=FBj19I80; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231321AbjAAEeY (ORCPT + 61 others); Sat, 31 Dec 2022 23:34:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbjAAEeW (ORCPT ); Sat, 31 Dec 2022 23:34:22 -0500 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45BEC6375 for ; Sat, 31 Dec 2022 20:34:21 -0800 (PST) Received: from [IPV6:2601:646:8600:40c1:5967:deb4:a714:2940] ([IPv6:2601:646:8600:40c1:5967:deb4:a714:2940]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.17.1) with ESMTPSA id 3014Y4Ss1855911 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sat, 31 Dec 2022 20:34:05 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 3014Y4Ss1855911 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2022120601; t=1672547646; bh=VpwZJfHjUoFCQG04147cJw1T6GjsP7kTmWFVBOMEzis=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FBj19I80P/nTqvFwmpAMVESYgiNL+uPue00zX9GK6uE6lH5ZLMxKP/u7h+zU9c9U+ VL6mDEnllaUrwWJ+/eWcXib16lPgJGsegWLNVsWJ+6KYPOtK4kRWSji4CUFB7dLBwX 3SF2nN7UCuGWX6uRVA+UvjgK9e7HXG/N9RzHx1ng6ut2LrXIIzBYbSoA2HL9St6Fh0 JFj+rWaRfUMF7n/iqo0td/ab6vDdojuMsR15IrAIyOq7Y5PjwYRe8W//TaTWYUNDWg DtBOQ6EZxPVwj4Aqzrvw4PM8SD9Osy5sN7Gk/4TCOPEBS974Lbevdhp6QOHyFyeBYe SswuztX9dAvkA== Message-ID: <24908710-09f6-da2a-d821-58a81c572f6c@zytor.com> Date: Sat, 31 Dec 2022 20:33:59 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH qemu] x86: don't let decompressed kernel image clobber setup_data Content-Language: en-US To: "Jason A. Donenfeld" , Borislav Petkov Cc: 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 References: <46466e54-25c3-3194-8546-a57cd4a80d9d@zytor.com> From: "H. Peter Anvin" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RDNS_NONE, SPF_HELO_PASS,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 12/31/22 10:22, Jason A. Donenfeld wrote: > On Sat, Dec 31, 2022 at 03:24:32PM +0100, Borislav Petkov wrote: >> On Sat, Dec 31, 2022 at 02:51:28PM +0100, Jason A. Donenfeld wrote: >>> That failure is unrelated to the ident mapping issue Peter and >>> I discussed. The original failure is described in the commit message: >>> decompression clobbers the data, so sd->next points to garbage. >> >> Right > > So with that understanding confirmed, I'm confused at your surprise that > hpa's unrelated fix to the different issue didn't fix this issue. > If decompression does clobber the data, then we *also* need to figure out why that is. There are basically three possibilities: 1. If physical KASLR is NOT used: a. The boot loader doesn't honor the kernel safe area properly; b. Somewhere in the process a bug in the calculation of the kernel safe area has crept in. 2. If physical KASLR IS used: The decompressor doesn't correctly keep track of nor relocate all the keep-out zones before picking a target address. One is a bootloader bug, two is a kernel bug. My guess is (2) is the culprit, but (1b) should be checked, too. -hpa