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: <Z0Q5MIjy0yx6jyNq@gmail.com>
Date: Mon, 25 Nov 2024 09:45:36 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
	"H. Peter Anvin" <hpa@...or.com>, Jonathan Corbet <corbet@....net>,
	Cloud Hsu <cloudhsu@...gle.com>, Chris Koch <chrisko@...gle.com>
Subject: Re: [PATCH v1 1/1] x86/Documentation: Update algo in init_size
 description of boot protocol


* Randy Dunlap <rdunlap@...radead.org> wrote:

> Hi Andy,
> 
> On 11/25/24 12:31 AM, Andy Shevchenko wrote:
> > The init_size description of boot protocol has an example of the runtime
> > start address for the compressed bzImage. For non-relocatable kernel
> > it relies on the pref_address value (if not 0), but for relocatable case
> > only pays respect to the load_addres and kernel_alignment, and it is
> > inaccurate for the latter. Boot loader must consider the pref_address
> > as the Linux kernel relocates to it before being decompressed as nicely
> > described in the commit 43b1d3e68ee7 message.
> > 
> > Due to this inaccuracy some of the bootloaders (*) made a mistake in
> > the calculations and if kernel image is big enough, this may lead to
> > unbootable configurations.
> > 
> > *)
> >   In particular, kexec-tools missed that and resently got a couple of
> >   changes which will be part of v2.0.30 release. For the record,
> >   the 43b1d3e68ee7 fixed only kernel kexec implementation and also missed
> >   to update the init_size description.
> > 
> > While at it, make an example C-like looking as it's done elsewhere in
> > the document and fix indentation, so the syntax highliting will work
> > properly in some editors (vim).
> > 
> > Fixes: 43b1d3e68ee7 ("kexec: Allocate kernel above bzImage's pref_address")
> > Fixes: d297366ba692 ("x86: document new bzImage fields")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > ---
> >  Documentation/arch/x86/boot.rst | 17 +++++++++++++----
> >  1 file changed, 13 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/arch/x86/boot.rst b/Documentation/arch/x86/boot.rst
> > index 4fd492cb4970..01f08d94e8df 100644
> > --- a/Documentation/arch/x86/boot.rst
> > +++ b/Documentation/arch/x86/boot.rst
> > @@ -896,10 +896,19 @@ Offset/size:	0x260/4
> >  
> >    The kernel runtime start address is determined by the following algorithm::
> >  
> > -	if (relocatable_kernel)
> > -	runtime_start = align_up(load_address, kernel_alignment)
> > -	else
> > -	runtime_start = pref_address
> > +    if ( relocatable_kernel ) {
> > +      if ( load_address < pref_address )
> 
> What's up with the extra spaces around ( and ) ... and inconsistent with
> the lines below?

Also, even pseudocode should follow the kernel's coding style and use 
tabs in particular - which it already does in (some...) other places of 
this document, such as the 'Sample Boot Configuration' chapter.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ