Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9184424rwl; Sat, 31 Dec 2022 21:27:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXus19I5IDTgi+8IHNRBa/v2cVDjYftohpTIc/aQ8ZXGRFmrIark5ajjKmZwIWGdcPx6c+G2 X-Received: by 2002:a50:eacc:0:b0:46c:ec6f:43d7 with SMTP id u12-20020a50eacc000000b0046cec6f43d7mr44742015edp.19.1672550839748; Sat, 31 Dec 2022 21:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672550839; cv=none; d=google.com; s=arc-20160816; b=e9sGLWYZl+GoEKFuCOvDv5RXawLiUj81wg9/aMtMlxuvnbg+jZcTOw9QrqvaMvcv1W J/7lKCmYnJzjLRR/Vwhvv50/E6DMEcA1WOpi2r9/JpDULIQBshlmPgPtIOIakPCiBuYI 63eDlBbk+Tlwp7RDg1IECorc5mdgTYb7yk4JU8BgPo6XIiFydBeG8T1PWmK/dkKBx4Vz nEBf2upl560MBmsz69T5PtuXLOpZfrAY5zqceYVHBJGKumQ/g2XznKmjZp1UCxey89UO TLnnajNwVC1v1fOIEfPRBlOT5FRsCD4AEBhIbusBNNq9lpIJNtUfeaVABpdIb+SbmOoD +JKw== 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=XvctRQLj9YqHf5hWoWYxkxZytQ0uCledKXjllozj4oM=; b=X4AhENx2WgIt1Jun05kwLkyj2DEjWFJXfQ/rDvoOPbvlwaXdfs4oYut2RGF7SPj4Ab 13H3jvhqJi8GuoG8efL49VnA7leAnAjo1ybM348c55fHByhRUOFf6mXTmkzVj9j9VhYJ 7RCm+b+wDz4X8X9GrbHmzcTbGKZ2YD28dg7JIZ6q3hxDuQV8xbXc/zhiVA1UD85uFFpG YZXgNuiHzSEq4PMCPqtFxs107dOoRDIEJ8TyfmQR/Gp3YW+9lIEhYiHc1xEEGriOetXj IETBIpHy0TRAccapraH6/0VOayZWrT2tkgrugkCi2PfIeyKXUur7OaibgLYwCo2QfF3U qYxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2022120601 header.b=d6NR5eTp; 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 n21-20020a056402515500b0047338d1bfb8si19973990edd.157.2022.12.31.21.27.02; Sat, 31 Dec 2022 21:27:19 -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=d6NR5eTp; 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 S229554AbjAAFNc (ORCPT + 62 others); Sun, 1 Jan 2023 00:13:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjAAFN3 (ORCPT ); Sun, 1 Jan 2023 00:13:29 -0500 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E6D63BD for ; Sat, 31 Dec 2022 21:13:29 -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 3015DBR61865276 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sat, 31 Dec 2022 21:13:11 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 3015DBR61865276 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2022120601; t=1672549994; bh=XvctRQLj9YqHf5hWoWYxkxZytQ0uCledKXjllozj4oM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=d6NR5eTpTHxGnG1IhpDUfrgPvMsb4iEHpqaawrtbZGh7RjeaQ/B9ooQbnjch2y33m llGc2W5oPF9lNx29UZy2LBD80bJfFOB3T4dCLZPNqlaMt+SwA7zXrPcDwXVjBsCXV7 cN2Zm/juer05WMzGvwDMh5ekEgot5UWCIJ30YEDgOd3aUSdHo1ornv4bePHhUOXTIG Mj0Xk/1uRLfiCa6ZZ+hRZaiXQLChp/osA1G/Q1VSXofPlY6Cf65xsjban/yTc41j7p foYdtIbaqUNxhcEOAMN6k8bzyuNs82jl/nk5PmCgcXpeaE7Enbl1WeS3IZ6f6pWMkm RVqlsWhWKERaw== Message-ID: Date: Sat, 31 Dec 2022 21:13:05 -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: =?UTF-8?Q?Mika_Penttil=c3=a4?= , "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> <24908710-09f6-da2a-d821-58a81c572f6c@zytor.com> From: "H. Peter Anvin" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 20:55, Mika Penttilä wrote: >> >> 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. > > Seems setup_data is not included in those mem_avoid regions. > [facepalm] >> >> One is a bootloader bug, two is a kernel bugs. My guess is (2) is the >> culprit, but (1b) should be checked, too. >> Correction: two are kernel bugs, i.e. (1b) and (2) are both kernel bugs. -hpa