Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1789973rdb; Tue, 3 Oct 2023 00:28:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGK5Hb1OwUfdXlNUeVOo/29/7PnJwC8fkFvrH5geojGgiedTZoUXxT5w3d6SKibRt3m37hJ X-Received: by 2002:a17:90b:e09:b0:279:9f8:790c with SMTP id ge9-20020a17090b0e0900b0027909f8790cmr11555884pjb.37.1696318128542; Tue, 03 Oct 2023 00:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696318128; cv=none; d=google.com; s=arc-20160816; b=RAWy2k4MI6x1naVJ9GztZxoViFzwDPuif8Tqt/eZktgHA4acJUnUfcZnG0mHhLuGv0 MVg1cLB/FVhUAoTW9LqJagwfMJmBNMKEB5hevU92sGRwzxTXH/4neVo7tPsAaczXoYWN z6aiopWWQ7EtRCHiepFxA32XqQmjX5yuPeBG+t112z6VFLxkkssBsdJB4LGfnKSNSBvO bCteKBFX3N4vqAemuCfGVBB4vCyhCO3loaJgT+rfJdpcNgm5Dk0vj2/6sLke7C087i9v 8IS2iWX/fhBMo7cGcf/mM0LttAC7nQQJ6O9Y/fncA2Jsc2ZqVwNYr/00Rl+WMIePaVV4 lggg== 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:sender:dkim-signature; bh=Ucqw6X61coCqcSfzC4WcVSLrJYNxmNxx1TxpbToBncM=; fh=JAN2CzcwmQZummsPZWe5K9/m+6dzzosFNBo3YejduPQ=; b=u0RUuTaFWD5T9m907LVMIbTJt/yofTcjavO+AeCvVJ/Xbf5GpKXpz8nPPO4jSnAXuf Tqv4UVyf9CkDk8QBimnV5+MeZHWSMcWqC3tz0v+BvGDMMesBs2oBvXxjFanHHnYSdZqC gMgQWBfT7AiGmapgdd7MXthvW8mPox1hZzLD4u9reMhzWYKhoF6nuz10++eVMFKMx/F+ kMw52ozfCn88mkWG7+2LUHNxRbJic0qX8bjimMlSm25MGj/lXiK+RKHFdtX/j/IMOoQ4 HYkSiRABGDI9Z/pA2dm09dOuR61L1iC0GIagrYnXP29Mt8DIpykQ/KiboVKVKncQ+sgf A6gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Af1hw3Y0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p1-20020a17090a348100b002597ed3cc4fsi809651pjb.189.2023.10.03.00.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 00:28:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Af1hw3Y0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6C41380E73FF; Tue, 3 Oct 2023 00:28:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbjJCH2q (ORCPT + 99 others); Tue, 3 Oct 2023 03:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbjJCH2p (ORCPT ); Tue, 3 Oct 2023 03:28:45 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B59A83 for ; Tue, 3 Oct 2023 00:28:38 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9ae75ece209so91748366b.3 for ; Tue, 03 Oct 2023 00:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696318117; x=1696922917; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=Ucqw6X61coCqcSfzC4WcVSLrJYNxmNxx1TxpbToBncM=; b=Af1hw3Y0BcyVrxtwPR4gaeDoYQ9M84CIGN1thsP1b3RsKzvrp+HA/mESxxOkvV7WEs +njMV5c5FlImgCYgEPEYQpbmv1rFD13hgMQq6WxebScZVkrO/q6E3tOHsom1IzxvBkiD 9j7h1hHvt0mxJZWfbptxyLji9N9Jq+FBWAvEHICrmXgox92odLvgxM8YZ4qtla833Cta AFk1CKtP4a5jhPV/V/FL3gCMtvpGrRCHKhi1dU7O9o+aDUY9RghOJvkXXE3BG4dsfifu vZl9hqwrZFTey7A1viJm75WvfWal035wCz2WgqkLUq9GzjT+Db//2NUld2XtrudsQw3k hU4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696318117; x=1696922917; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ucqw6X61coCqcSfzC4WcVSLrJYNxmNxx1TxpbToBncM=; b=QT958qRfBtr0ZC7TMDp4+8Deu4wTN0WrxRmBfDEbzqXEsjhqwWx3O33ko6OXxQPR6/ gy1HOCPczIcNG4nlnac1rKwTFxE/8lUbSHAttrtlgqhUz3twK0A7gWSqEWgkpo/9D/vS +Ib4Nd5CPOdn5onG43yXc8bCX7qc2BeQjL6CID1ZfRSMwKPTQGjuUjPIHGCb5phYrqlw 9cfC7v+CfojeiJTQCkwEu9E1lZnA6jaIMiBeL/mcPrs2qwAnPGr8/lJcEgOFKpFhzE8T 2WPIJi/Ficjg/Kq3K0zW62Uk7JLe3atyAjGDn9KZjOdJmHmM++AWOa08qE6kDX725z/H gVyA== X-Gm-Message-State: AOJu0YyKxbaP8IRTX94OEiEdZxfxAmkUpQyrfyJHX4+qCforI7iG+iUs mvC8vxejpiWsfB66iK8bKmE= X-Received: by 2002:a17:906:20ce:b0:9a1:e233:e627 with SMTP id c14-20020a17090620ce00b009a1e233e627mr13839558ejc.42.1696318116414; Tue, 03 Oct 2023 00:28:36 -0700 (PDT) Received: from gmail.com (1F2EF530.nat.pool.telekom.hu. [31.46.245.48]) by smtp.gmail.com with ESMTPSA id r27-20020a17090638db00b0099cf9bf4c98sm567225ejd.8.2023.10.03.00.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 00:28:35 -0700 (PDT) Sender: Ingo Molnar Date: Tue, 3 Oct 2023 09:28:33 +0200 From: Ingo Molnar To: Nathan Chancellor Cc: Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, acdunlap@google.com, ashok.raj@intel.com, bp@alien8.de, david@redhat.com, dionnaglaze@google.com, hpa@zytor.com, jacobhxu@google.com, jgross@suse.com, jroedel@suse.de, khalid.elmously@canonical.com, kim.phillips@amd.com, kirill.shutemov@linux.intel.com, llvm@lists.linux.dev, luto@kernel.org, mingo@redhat.com, nikunj@amd.com, peterz@infradead.org, pgonda@google.com, rientjes@google.com, rppt@kernel.org, seanjc@google.com, tglx@linutronix.de, thomas.lendacky@amd.com Subject: Re: [PATCH] x86/boot: Move x86_cache_alignment initialization to correct spot Message-ID: References: <20231002200426.GA4127272@dev-arch.thelio-3990X> <20231002220045.1014760-1-dave.hansen@linux.intel.com> <20231002222402.GA486933@dev-arch.thelio-3990X> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231002222402.GA486933@dev-arch.thelio-3990X> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 00:28:47 -0700 (PDT) * Nathan Chancellor wrote: > On Mon, Oct 02, 2023 at 03:00:45PM -0700, Dave Hansen wrote: > > c->x86_cache_alignment is initialized from c->x86_clflush_size. > > However, commit fbf6449f84bf moved c->x86_clflush_size initialization > > to later in boot without moving the c->x86_cache_alignment assignment. > > > > This presumably left c->x86_cache_alignment set to zero for longer > > than it should be. > > > > The result was an oops on 32-bit kernels while accessing a pointer > > at 0x20. The 0x20 came from accessing a structure member at offset > > 0x10 (buffer->cpumask) from a ZERO_SIZE_PTR=0x10. kmalloc() can > > evidently return ZERO_SIZE_PTR when it's given 0 as its alignment > > requirement. > > > > Move the c->x86_cache_alignment initialization to be after > > c->x86_clflush_size has an actual value. > > > > Fixes: fbf6449f84bf ("x86/sev-es: Set x86_virt_bits to the correct value straight away, instead of a two-phase approach") > > Cc: Adam Dunlap > > Cc: Ingo Molnar > > Cc: Jacob Xu > > Link: https://lore.kernel.org/all/20231002200426.GA4127272@dev-arch.thelio-3990X/ > > Tested-by: Nathan Chancellor > > Thanks for the quick fix! Thanks for the quick testing - I've applied this fix on top of fbf6449f84bf in tip:x86/mm. Dave, I've added your SOB - let me know if that's not OK: Signed-off-by: Dave Hansen Thanks, Ingo