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>] [day] [month] [year] [list]
Message-ID: <48CACC8F.4050806@free.fr>
Date:	Fri, 12 Sep 2008 22:09:51 +0200
From:	matthieu castet <castet.matthieu@...e.fr>
To:	Linux Kernel list <linux-kernel@...r.kernel.org>,
	Andi Kleen <ak@...e.de>,
	"Keith A. Prickett" <keithp@...vell.com>
Subject: re : Building Kernel with -O0

Hi,

last time I check kernel build for x86 and arm with -O0, there was 
several issues.

First there some code that rely in function inline and code elimination, 
and cause usage of disable symbol at  -O0

#ifdef CONFIG_FOO
int foo()
{
}
static inline int toto()
{
}
#else
static inline int toto()
{
return 0
}
#endif

if (toto())
    foo();

This doesn't work even when using __always_inline (try to build attached 
undec.c at -O0).


Second, I saw problem with swab macro [1].
When using -O0, __OPTIMIZE__ is not defined, and constant initialisation 
of some code fails (I don't remeber exactly the case but removing the 
defined(__OPTIMIZE__) fix the issue).

Next for x86 there a driver with asm optimisation that fail to build 
because gcc fail to allocate register.

And finaly as Andi say there some code doing check if undefined symbol. 
For example slab index_of [2]

In the end I build the kernel at -O instead of -O0.

Matthieu

PS : I am not sure __always_inline always work at -O0...

[1]
#if defined(__GNUC__) && defined(__OPTIMIZE__)
#  define __swab16(x) \
(__builtin_constant_p((__u16)(x)) ? \
  ___constant_swab16((x)) : \
  __fswab16((x)))
#  define __swab32(x) \
(__builtin_constant_p((__u32)(x)) ? \
  ___constant_swab32((x)) : \
  __fswab32((x)))
#  define __swab64(x) \
(__builtin_constant_p((__u64)(x)) ? \
  ___constant_swab64((x)) : \
  __fswab64((x)))
#else
#  define __swab16(x) __fswab16(x)
#  define __swab32(x) __fswab32(x)
#  define __swab64(x) __fswab64(x)
#endif /* OPTIMIZE */

[2]
static __always_inline int index_of(const size_t size)
{
     extern void __bad_size(void);

     if (__builtin_constant_p(size)) {
         int i = 0;

#define CACHE(x) \
     if (size <=x) \
         return i; \
     else \
         i++;
#include <linux/kmalloc_sizes.h>
#undef CACHE
         __bad_size();
     } else
         __bad_size();
     return 0;
}

View attachment "undec.c" of type "text/x-csrc" (108 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ