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-next>] [day] [month] [year] [list]
Message-ID: <4EEA77E1.6050009@zytor.com>
Date:	Thu, 15 Dec 2011 14:42:41 -0800
From:	"H. Peter Anvin" <hpa@...or.com>
To:	David Howells <dhowells@...hat.com>,
	Stephen Hemminger <shemminger@...tta.com>,
	Alexander van Heukelum <heukelum@...lshack.com>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>
CC:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: x86: fls64() exported to user space but not fls()?

I'm trying to grok why fls64() seems to be exported to user space in
<asm/bitops.h> on x86 by unconditional inclusion of
<asm-generic/bitops/fls64.h>:

...
#endif /* __KERNEL__ */

#include <asm-generic/bitops/fls64.h>

#ifdef __KERNEL__
...


 whereas fls() isn't (although __fls() is!)

This is even more bizarre since <asm-generic/bitops/fls64.h> contains:

...
#if BITS_PER_LONG == 32
static __always_inline int fls64(__u64 x)
{
        __u32 h = x >> 32;
        if (h)
                return fls(h) + 32;
        return fls(x);
}
#elif BITS_PER_LONG == 64
static __always_inline int fls64(__u64 x)
{
        if (x == 0)
                return 0;
        return __fls(x) + 1;
}
#else
#error BITS_PER_LONG not 32 or 64
#endif
...

Both BITS_PER_LONG and fls() are non-user-visible symbols, so this code
should fail on user space.  Finally, <asm-generic/bitops/*> are
non-exported headers; they are not installed by make headers_install.

Is the #endif..#ifdef in <asm/bitops.h> a bug, plain and simple?

	-hpa
--
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