Bug#504699: libc6: makecontext() on AMD64 does not handle pointers; docs do not make this clear
reassign 504699 manpages-dev
severity 504699 minor
thanks
On Thu, Nov 06, 2008 at 11:27:01AM +0000, Paul Evans wrote:
> Package: libc6
> Version: 2.7-15
> Severity: normal
>
>
> makecontext() on AMD64 cannot pass pointer arguments to the invoked
> function; they get squashed to 32bit values, ignoring the top bits.
>
> I'm aware that the POSIX spec doesn't require the ability to pass
> pointers, though it isn't all that clear on the subject.
It is pretty clear from the POSIX specification:
| Before a call is made to makecontext( ), the application shall ensure that the context being
| modified has a stack allocated for it. The application shall ensure that the value of argc matches
| the number of arguments of type int passed to func; otherwise, the behavior is undefined.
The original POSIX specification even has "int" in bold in the text.
> I've had a variety of C programmers read the makecontext(3) manpage, and
> most of them didn't spot the fact it can't do pointers until I
> specifically mentioned this fact. The current documentation is
> insufficiently clear on the subject.
>
> I'd like to propose either:
>
> a) Extending makecontext() on AMD64 so it can pass pointers, and add a
> section to the manpage to explain that you cannot portably do this,
> but GNU libc happens to allow it,
This is not possible, as it would break the ABI, something we do not
want, and break the compliance to POSIX.
> or
>
> b) Explain in the manpage that GNU libc cannot pass pointers.
It already looks clear to me:
| When this context is later activated (using setcontext(2) or swapcontext()) the function
| func is called, and passed the series of integer (int) arguments that follow argc;
Again the type of the argument (int) is precised.
Anyway it's not a glibc bug, so I'll reassign it to manpages-dev and
let the maintainer of this package either to close the bug or to precise
the documentation.
> Naturally I'd prefer option a because that is more useful; without the
> ability to pass a pointer, it becomes much harder to actually use the
> function to perform useful work in real programs, aside from the tiny
> trivial examples usually given.
>
>
> -- System Information:
> Debian Release: lenny/sid
> APT prefers testing
> APT policy: (990, 'testing'), (500, 'unstable')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 2.6.26-1-amd64 (SMP w/4 CPU cores)
> Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash
>
> Versions of packages libc6 depends on:
> ii libgcc1 1:4.3.2-1 GCC support library
>
> libc6 recommends no packages.
>
> Versions of packages libc6 suggests:
> pn glibc-doc <none> (no description available)
> ii locales 2.7-15 GNU C Library: National Language (
>
> -- debconf information:
> glibc/upgrade: true
> glibc/restart-failed:
> glibc/restart-services:
>
>
>
> --
> To UNSUBSCRIBE, email to debian-glibc-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
Reply to: