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]
Date:	Sun, 19 Aug 2007 17:57:56 -0700
From:	David Brownell <david-b@...bell.net>
To:	Anton Altaparmakov <aia21@....ac.uk>
Cc:	Al Viro <viro@....linux.org.uk>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

On Sunday 19 August 2007, Anton Altaparmakov wrote:
> >
> > ISTR we don't *have* a uintptr_t on all architectures, or that would
> > be the appropriate thing to use in these 32/64 bit ABI scenarios.
> >
> >
> >> Use unsigned long or uintptr_t instead.
> >
> > I suspect you mean "unsigned long long"...
> 
> No he doesn't.  "unsigned long" is guaranteed to be large enough to  
> hold a pointer (at least on Linux anyway).

And yet when I used that, I got compiler warnings on some systems.

ISTR that was the first solution I tried, but GCC really wanted to
issue warnings.  Either about casting 64-bit to pointer, or about
casting it to "unsigned long", either way lost precision.


> On a 32-bit arch "unsigned long" is 32-bit and pointers are 32-bit.
> 
> On a 64-bit archi "unsigned long" is 64-bit and pointers are 64-bit.

So with 32 bit userspace "unsigned long long" is the type to use
when talking to a 64-bit kernel; and with pure 64-bit code, it's
enough to write "unsigned long".

I'm fairly sure that's the root cause of the pain I recall here;
but I'd have to run experiments again to verify that.  


-
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