lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240731165108.GH33588@noisy.programming.kicks-ass.net>
Date: Wed, 31 Jul 2024 18:51:08 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
	Guenter Roeck <linux@...ck-us.net>, Jens Axboe <axboe@...nel.dk>,
	Andy Lutomirski <luto@...nel.org>, Ingo Molnar <mingo@...hat.com>,
	Peter Anvin <hpa@...or.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	the arch/x86 maintainers <x86@...nel.org>
Subject: Re: Linux 6.11-rc1

On Wed, Jul 31, 2024 at 06:31:05PM +0200, Peter Zijlstra wrote:
> On Wed, Jul 31, 2024 at 09:17:44AM -0700, Linus Torvalds wrote:
> > On Wed, 31 Jul 2024 at 08:55, Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > > Right, so Thomas found that i386-pti fails to map the entire entry text.
> > > Specifically pti_clone_pgtable() hard relies -- and does not verify --
> > > that the start address is aligned to the given granularity.
> > >
> > > Now, i386 does not align __entry_text_start, and so the termination
> > > condition goes sideways and pte_clone_entry() does not always work right
> > > and it becomes a games of code layout roulette.
> > 
> > Lovely.
> 
> :-)
> 
> This fixes the alignment assumptions and makes it all go again.

Thomas, this all still relies on the full text section being PMD mapped,
and since we don't have ALIGN_ENTRY_TEXT_END and _etext has PAGE_SIZE
alignment, can't have a PAGE mapped tail which then doesn't get cloned?

Do we want to make pto_clone_entry_text() use PTI_LEVEL_KERNEL_IMAGE
such that it will clone whatever it has?

> diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
> index 2e69abf4f852..bfdf5f45b137 100644
> --- a/arch/x86/mm/pti.c
> +++ b/arch/x86/mm/pti.c
> @@ -374,14 +374,14 @@ pti_clone_pgtable(unsigned long start, unsigned long end,
>  			 */
>  			*target_pmd = *pmd;
>  
> -			addr += PMD_SIZE;
> +			addr = round_up(addr + 1, PMD_SIZE);
>  
>  		} else if (level == PTI_CLONE_PTE) {
>  
>  			/* Walk the page-table down to the pte level */
>  			pte = pte_offset_kernel(pmd, addr);
>  			if (pte_none(*pte)) {
> -				addr += PAGE_SIZE;
> +				addr = round_up(addr + 1, PAGE_SIZE);
>  				continue;
>  			}
>  
> @@ -401,7 +401,7 @@ pti_clone_pgtable(unsigned long start, unsigned long end,
>  			/* Clone the PTE */
>  			*target_pte = *pte;
>  
> -			addr += PAGE_SIZE;
> +			addr = round_up(addr + 1, PAGE_SIZE);
>  
>  		} else {
>  			BUG();

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ