This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Re: {make,set,swap}context broken on powerpc32
On Wed, Dec 13, 2006 at 09:47:57AM +0100, Jakub Jelinek wrote:
> > Could you strace your test program and see whether it is using
> > sys_swapcontext or sys_rt_sigreturn?
>
> It uses sys_swapcontext to fill it up (i.e. in getcontext calls)
> and apparently sys_rt_sigreturn in setcontext (sorry I haven't noticed that),
> will look why:
The reason for this is a bug in glibc, while getcontext/swapcontext both
include kernel-features.h and thus __ASSUME_SWAPCONTEXT_SYSCALL is defined
in --enable-kernel=2.6.9 builds, setcontext does not and therefore it
always uses other methods. Sorry for thinking it was making a swapcontext
syscall even the third time, I saw it is making some syscall under gdb
and looking at the source I it appeared it would use swapcontext.
While this cures the testcase I posted (r2 is no longer restored by
swapcontext), I still don't like the realignment. Either the kernel
has a bug and should always align, or makecontext needs to memmove when it
realigns.
2006-12-13 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S: Include
kernel-features.h.
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S.jj 2005-12-30 09:04:17.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S 2006-12-13 09:49:29.000000000 +0100
@@ -1,5 +1,5 @@
/* Jump to a new context.
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,6 +20,7 @@
#include <sysdep.h>
#include <rtld-global-offsets.h>
#include <shlib-compat.h>
+#include <kernel-features.h>
#define __ASSEMBLY__
#include <asm/ptrace.h>
Jakub