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: <CAMe9rOr883q0OAsh+JGA83ww603y6QSbQJKx+wk2YJfkYcaEdQ@mail.gmail.com>
Date:	Thu, 17 May 2012 21:13:58 -0700
From:	"H.J. Lu" <hjl.tools@...il.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	"H. Peter Anvin" <hpa@...nel.org>, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org, mingo@...nel.org, tglx@...utronix.de,
	Paul Mundt <lethal@...ux-sh.org>,
	David Howells <dhowells@...hat.com>
Subject: Re: [PATCH 08/10] Use __kernel_ulong_t in struct msqid64_ds

On Thu, May 17, 2012 at 9:05 PM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Thu, May 17, 2012 at 8:59 PM, H.J. Lu <hjl.tools@...il.com> wrote:
>>
>> But __BITS_PER_LONG used in kernel header files really
>> means "long" as seen by kernel, not by user space.
>
> No, hjl, no it does NOT.
>
> That might be what we'd all *wish* it did, but it's not at all what it does.
>
> What it actually means is "how many bits in a long as it is being
> compiled right now".
>
> User code headers have absolutely *no* idea what the size "long" the
> kernel was compiled with. You'd have to do an "uname()" system call to
> figure that out, and even then you shouldn't be sure if the kernel is
> just really good at compatibility mode.
>
> Just look at the code. It literally sets __BITS_PER_LONG depending on
> *compiler* flags like __s390x__ etc. Which depend on things like
> "-m32" etc as done in user space.
>
> When those same headers are compiled *as*part*of*the*kernel*, then -
> and only then - does __BITS_PER_LONG hopefully match what the kernel
> "long" is. But that is kind of irrelevant, because if this was purely
> a kernel issue, we would use the non-underscore version (ie just
> "BITS_PER_LONG") which is *only* for the kernel, and not exported to
> user space at all.
>

Since x32 uses the same kernel interface as x86-64 with a few
exceptions.  The current kernel header files with

#ifdef __x86_64__
# define __BITS_PER_LONG 64
#else
# define __BITS_PER_LONG 32
#endif

#if __BITS_PER_LONG == 64
Define x86-64 types
#endif

work fine for x32 even if long for x32 is 32 bits.  If __BITS_PER_LONG
is changed to 32 for x32, many types in kernel header files will be
wrong for x32.


-- 
H.J.
--
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