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: <m1d4kdk2fw.fsf@frodo.ebiederm.org>
Date:	Tue, 12 Aug 2008 20:40:19 -0700
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Huang Ying <ying.huang@...el.com>
Cc:	Simon Horman <horms@...ge.net.au>, Pavel Machek <pavel@....cz>,
	nigel@...el.suspend2.net, "Rafael J. Wysocki" <rjw@...k.pl>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Vivek Goyal <vgoyal@...hat.com>, mingo@...e.hu,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Kexec Mailing List <kexec@...ts.infradead.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kexec jump: fix code size checking

Huang Ying <ying.huang@...el.com> writes:

> On Wed, 2008-08-13 at 12:47 +1000, Simon Horman wrote:
>> On Wed, Aug 13, 2008 at 09:04:35AM +0800, Huang Ying wrote:
>> > Fix building issue when CONFIG_KEXEC=n. Thanks to Vivek Goyal for his
>> > reminding.
>> > 
>> > Signed-off-by: Huang Ying <ying.huang@...el.com>
>> > 
>> > ---
>> >  include/asm-x86/kexec.h |    3 +++
>> >  1 file changed, 3 insertions(+)
>> > 
>> > --- a/include/asm-x86/kexec.h
>> > +++ b/include/asm-x86/kexec.h
>> > @@ -43,6 +43,9 @@
>> >  
>> >  #ifdef CONFIG_X86_32
>> >  # define KEXEC_CONTROL_CODE_MAX_SIZE	2048
>> > +# ifndef CONFIG_KEXEC
>> > +#  define kexec_control_code_size	0
>> > +# endif
>> >  #endif
>> >  
>> >  #ifndef __ASSEMBLY__
>> 
>> Is it impossible to skip the linker check in the !CONFIG_KEXEC case?
>
> It is possible. I think there are several ways to do that.
>
> 1) use #ifdef in vmlinux_32.lds.S, such as:
>
> #ifdef CONFIG_KEXEC
> ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
>        "kexec control code size is too big")
> #endif
>
> 2) #define a macro for kexec check ld script in asm/kexec.h, such as:
>
> #define LD_CHECK_KEXEC() ASSERT(kexec_control_code_size <=
> KEXEC_CONTROL_CODE_MAX_SIZE, \
> 				       "kexec control code size is too big")
>
> and use that in vmlinux_32.lds.S.
>
> 3) #define kexec_control_code_size 0. So that the check can be passed
> always. And, code size = 0 is reasonable for no code (CONFIG_KEXEC=n).
>
>
> I think 3) is better. What do you think about?

4) Put the code is a special section .text.kexec? and have the linker
   always do the size comparison and the computation of the section size.

The fewer conditionals we have the less likely something is to break.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ