Message ID | ZbmOjKnARGiaYBd5@dwarf.suse.cz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-45509-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1574996dyb; Tue, 30 Jan 2024 16:04:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEiOv8o4cvmxkp5RKtzFhUpzmtx32uwavIt21bqFNZlBlPFSeC0KP9yGjOkfJlCkhk2YzBt X-Received: by 2002:a05:6a20:5a01:b0:19c:6cae:508e with SMTP id jz1-20020a056a205a0100b0019c6cae508emr1478pzb.36.1706659490506; Tue, 30 Jan 2024 16:04:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706659490; cv=pass; d=google.com; s=arc-20160816; b=IQvdeIW0Vp/vNUC6/57S1O9gbeF2yYirSRJ0zdYVhxYqW5ycNJ2tmiLoweyGKv5wrR Xc705BLVtVE1PO/cDOOXhcSXLbZgwm/u91l2wtdFlG7jXeSLV4IJLQqzHyl95k1D9GXd BaxXsenlQtvcRLU7LNq9cOVO7aoVbSTtKUcSkTvxE761jK7ffjagkFnkLHoXquiI7krZ PPCzTAnYr31RE3x2Sen0luJIbfSKBfTLJam6a8fAJIVyqgXOb6YS0m9gcvVmXd2/znNH qGcwbhLx2Bhq46LiWS7TEa/P5wA0oG7x9k6W6eVcZl9pUk6Ky8wLmyoOMjY4DKrmY8fk K3jQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=0XeDypmWoFCxEAOSG8Ni46O4GVdc987V5RE1wFxEfLs=; fh=qEHdOUY8Ec2H2RiFZe5waNjOQWn6T2IALWYhNPGT7HY=; b=nnV/oEvT1I02lIJH64PAvhGHMwZwIrmDZP9RDgsEeFcyGz0qaRSR7zziCRozPtMgzR /iCT+52q2KHQiolxC61Au1qUDSz5R82QlvSoCSplHtf6eq+zj/OIj6CnKrlq/SWg3pHD mq0lBzdp73gbTc4BZ2hnKq5CSmEl/NsUEgvh3DGTBDEiIS+HGQVWoGdKbQc/OkVZiXSX mXUHaS9Lpoxyp25m8NiTZxK/MTAEj4LdIcOcEaRqFcS9g5qfa4yxYxH5aptP/SabBlwS /LacbKJfqN2VADS7nvAVqlkjcetKao32YMZYUK+za5UhAFi6RGkvwzyfFtYfXvPNXViT WDbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ZrHrQ4QY; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=F6GbEu3l; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-45509-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45509-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWi+a4QaeR+R8T42+VcP8fwKrZVGXL2pexR0t+Lhi82dPsIBtnH3yjJEUAEtSNclSLSo1vSXkQ5e23UlSSy9lTY+U87nQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h2-20020aa79f42000000b006dbc594ed49si8151821pfr.326.2024.01.30.16.04.50 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 16:04:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45509-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ZrHrQ4QY; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=F6GbEu3l; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-45509-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45509-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 49B2A28576B for <ouuuleilei@gmail.com>; Wed, 31 Jan 2024 00:04:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC8CA1FB3; Wed, 31 Jan 2024 00:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="ZrHrQ4QY"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="SIYstLZy"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="F6GbEu3l"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="gd3zlcqa" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DA16136A for <linux-kernel@vger.kernel.org>; Wed, 31 Jan 2024 00:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706659476; cv=none; b=a+u+Amue5UTpPjTGXcjUcFGaLnwHvRlrD4juOJqfUQSF9j/vkb0v7c9hHRNvEJKxvXfh8ufvZ4C7ZlOIhziFzNe7M56KdpgIJ3X9/fi2Q4CN6VeYToT6bKsoXU9tKfNb5e6RczCtlz/uqcRbFQzq2a/QE6yQ52KokLS6gfVXiwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706659476; c=relaxed/simple; bh=rRqxO0gki4Gjc/MK2dXPYGxgGhxCZWwwQ4PVNhKZVGw=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=rvEz/7+CGMsBPwXXbLE6cOnsz4tSDpnM14eS+4ICpHliUOFiLvqiYqeNi8CsaG6Vo1tv9UTiuQ/BQ4VfQ3QEIxGpHYTbo1flQR09Mm3BPLFftlrBC5telmUv5epFnO++BG+gMS2P2QRZ49eKjpk83hAp4VBQl7B6EYCKpswF+/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=ZrHrQ4QY; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=SIYstLZy; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=F6GbEu3l; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=gd3zlcqa; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from localhost (unknown [10.100.12.32]) by smtp-out1.suse.de (Postfix) with ESMTP id DBBA721FD0; Wed, 31 Jan 2024 00:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1706659469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=0XeDypmWoFCxEAOSG8Ni46O4GVdc987V5RE1wFxEfLs=; b=ZrHrQ4QYC2PkGTYYJ+eRHVLnr1v0IZVgSGrq9LPeadWFLIlqA0mc5iEF93QACF9vXDvkds WD7kZ1fyIB5mJ5SxouCKu+i8MO1QC1/B0Zt98/Ze4tiGTrug2N+5ThyT7i6Nq7487D/CP3 IATkfCQB/8T4c4QBEmPMdmsra6fVOpc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1706659469; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=0XeDypmWoFCxEAOSG8Ni46O4GVdc987V5RE1wFxEfLs=; b=SIYstLZyd+10l7UljKL3sH8cYAMRaB2OsoBc/LpSAdSH79eyNDIr241SF2UoJSsQAfVksD nwE/DUCD4Tny9XCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1706659468; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=0XeDypmWoFCxEAOSG8Ni46O4GVdc987V5RE1wFxEfLs=; b=F6GbEu3ltqIflLc6pKAy/CffJjsm5XqUJ4MAp5rdUZM0p/CsYHqvIYX0nDHCr6oJ9O7FLk HTyzl4WOdSt9Ce/q+ZnPZH7LiiIamniSOxppIHcXTz9KrEUCdnWkEyatplNY89DxemiN9x DUfwxr1F2cT3d8sYhNP/Z+/G1t2IXIw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1706659468; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=0XeDypmWoFCxEAOSG8Ni46O4GVdc987V5RE1wFxEfLs=; b=gd3zlcqa+lGfSBc7xwkdHsUG2ZLdfnJhctfbhkZ5ERqiQaq4YtDDUK3VZ7K5Ej9hUSjxv4 1RGCSFc2MBZAlRAQ== Date: Wed, 31 Jan 2024 01:04:28 +0100 From: Jiri Bohac <jbohac@suse.cz> To: x86@kernel.org, "Jason A. Donenfeld" <Jason@zx2c4.com>, Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com> Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Dave Hansen <dave.hansen@linux.intel.com>, linux-kernel@vger.kernel.org Subject: [PATCH] x86: don't reserve SETUP_RNG_SEED in e820 Message-ID: <ZbmOjKnARGiaYBd5@dwarf.suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-0.10 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[8]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -0.10 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789562181707303568 X-GMAIL-MSGID: 1789562181707303568 |
Series |
x86: don't reserve SETUP_RNG_SEED in e820
|
|
Commit Message
Jiri Bohac
Jan. 31, 2024, 12:04 a.m. UTC
SETUP_RNG_SEED in setup_data is supplied by kexec and should
not be reserved in the e820 map.
Doing so reserves 16 bytes of RAM when booting with kexec.
(16 bytes because data->len is zeroed by parse_setup_data so only
sizeof(setup_data) is reserved.)
When kexec is used repeatedly, each boot adds two entries in the
kexec-provided e820 map as the 16-byte range splits a larger
range of usable memory. Eventually all of the 128 available entries
get used up. The next split will result in losing usable memory
as the new entries cannot be added to the e820 map.
Fixes: 68b8e9713c8e ("x86/setup: Use rng seeds from setup_data")
Signed-off-by: Jiri Bohac <jbohac@suse.cz>
---
arch/x86/kernel/e820.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
Adding Andrew Morton - have I been sending this to the wrong people/lists? On Tue, Feb 20, 2024 at 02:55:27PM +0100, Jiri Bohac wrote: > SETUP_RNG_SEED in setup_data is supplied by kexec and should > not be reserved in the e820 map. > > Doing so reserves 16 bytes of RAM when booting with kexec. > (16 bytes because data->len is zeroed by parse_setup_data so only > sizeof(setup_data) is reserved.) > > When kexec is used repeatedly, each boot adds two entries in the > kexec-provided e820 map as the 16-byte range splits a larger > range of usable memory. Eventually all of the 128 available entries > get used up. The next split will result in losing usable memory > as the new entries cannot be added to the e820 map. > > Fixes: 68b8e9713c8e ("x86/setup: Use rng seeds from setup_data") > Signed-off-by: Jiri Bohac <jbohac@suse.cz> > --- > arch/x86/kernel/e820.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c > index 91ade749f184..7be1362a31aa 100644 > --- a/arch/x86/kernel/e820.c > +++ b/arch/x86/kernel/e820.c > @@ -1018,10 +1018,12 @@ void __init e820__reserve_setup_data(void) > e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN); > > /* > - * SETUP_EFI and SETUP_IMA are supplied by kexec and do not need > - * to be reserved. > + * SETUP_EFI, SETUP_IMA and SETUP_RNG_SEED are supplied by > + * kexec and do not need to be reserved. > */ > - if (data->type != SETUP_EFI && data->type != SETUP_IMA) > + if (data->type != SETUP_EFI && > + data->type != SETUP_IMA && > + data->type != SETUP_RNG_SEED) > e820__range_update_kexec(pa_data, > sizeof(*data) + data->len, > E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
On Wed, Feb 28, 2024 at 10:45:02AM +0100, Jiri Bohac wrote:
> Adding Andrew Morton - have I been sending this to the wrong people/lists?
You're experiencing people trying to drink from the water hose...
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 91ade749f184..7be1362a31aa 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1018,10 +1018,12 @@ void __init e820__reserve_setup_data(void) e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN); /* - * SETUP_EFI and SETUP_IMA are supplied by kexec and do not need - * to be reserved. + * SETUP_EFI, SETUP_IMA and SETUP_RNG_SEED are supplied by + * kexec and do not need to be reserved. */ - if (data->type != SETUP_EFI && data->type != SETUP_IMA) + if (data->type != SETUP_EFI && + data->type != SETUP_IMA && + data->type != SETUP_RNG_SEED) e820__range_update_kexec(pa_data, sizeof(*data) + data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);