[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] x86: fix setup of brk area
- To: Juergen Gross <jgross@xxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 23 Jun 2022 10:50:17 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tJntYUc7/9EMUW5ebl5CjETPcg+UXjq6Lx4oGSxkdEw=; b=YpEYbv13R/CphFyBtNDy87sGfkyqDitCdRxSwT2jqG509m7Temk/gCvm4b+lJqRRj/7XbVfdOW3h1pcT/KDaY7ofdMtWgP+gzvQ27awnp8eLe3vU/DYY3iXcPWvXlY0P+rE1W27G96zU4Smv3ZhWQknapwgBsfuCLl9BKP8ablHdDTE58cJ1+LVQcuyGYOhAM9IikkvsE+nIQ/fXN7t1lZ35BhgikeKfZvto5DdZY4l+RzH+7ir/GGsgKK2XkogGtu3tQxFQce4vnNslWMTU0/rGmzfqGh60YC9X2e5CQ3gR9sv2sPUDOMsbwCLQhXTy2RE4qlXfRtbHjteze1/pPw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f7+wIYL73JutarJJhDTigzhedtuJVKfCooNHDPP1cUcWSNR35bta/YolXXYmNkZDx9WaWuGZ9fgrnFZgB5/9MnWjnqzxr/WT2EWso/CVSczIZ6NDOskyyo1mjXTj3GJaq8kT9kr9wz8HUfCliW+ia34fZiMqdGetVULAE0WkFCtRadze6jBdcBWO1BnkTyvt+fwczFDaP064R1vIgJTN4BrA0alRC9VVFXUJeACy5b2qv4Y9wkGRxEOkdKDijQn/WpWH7wofIxkFiWEcpRZoPTh1O72kwIP6/E/mqNUOZMJux0QvUHj3e9VmScxrjL8JFY7mSXAx9JV65IoNsC188g==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, x86@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
- Delivery-date: Thu, 23 Jun 2022 08:50:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 23.06.2022 10:14, Juergen Gross wrote:
> On 23.06.22 10:09, Jan Beulich wrote:
>> On 22.06.2022 18:10, Juergen Gross wrote:
>>> Commit e32683c6f7d2 ("x86/mm: Fix RESERVE_BRK() for older binutils")
>>> put the brk area into the .bss segment, causing it not to be cleared
>>> initially.
>>
>> This reads contradictively: If the area was put in .bss, it would be
>> cleared. Thing is it is put in .bss..brk in the object files, while
>> the linker script puts it in .brk (i.e. outside of .bss).
>
> Hmm, yes, this should be reworded.
>
>>
>>> As the brk area is used to allocate early page tables, these
>>> might contain garbage in not explicitly written entries.
>>
>> I'm surprised this lack of zero-initialization didn't cause any issue
>> outside of PV Xen. Unless of course there never was the intention for
>> users of the facility to assume blank pages coming from there, in
>> which case Xen's use for early page tables would have been wrong (in
>> not explicitly zeroing the space first).
>
> Fun fact: Its not Xen's use for early page tables, but the kernel's
> init code. It is used for bare metal, too.
>
> The use case for initial page tables is the problematic one. Only the
> needed page table entries are written by the kernel, so the other ones
> keep their initial garbage values. As normally no uninitialized entries
> are ever referenced, this will have no real impact.
Are you sure there couldn't surface user-mode accessible page table
entries pointing at random pages?
Jan
|