Bug 7891 - vdso page is no longer mapped for a.out binaries in kernel 2.6.18
Summary: vdso page is no longer mapped for a.out binaries in kernel 2.6.18
Status: CLOSED CODE_FIX
Alias: None
Product: Process Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: process_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-26 14:31 UTC by J
Modified: 2007-03-13 05:39 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.18 and later
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description J 2007-01-26 14:31:46 UTC
Most recent kernel where this bug did *NOT* occur: 2.6.17.14
Distribution: vanilla kernel
Hardware Environment: x86-32
Software Environment: gentoo
Problem Description: this is a 2.6.18 regression bug.

In kernel 2.6.18 the vdso page is no longer mapped for a.out binaries.
For instance a program using sleep will sigsegv on delivery of SIGALRM (to be
precise: on return from signal handling). I tested this using a static a.out
binary. This program does work in 2.6.17 . 

cat /proc/pid/smaps does show that vdso is not mapped in 2.6.18 for an a.out
binary. I had a look at fs/binfmt_elf.c and found that the vdso pages is mapped
using arch_setup_additional_pages from arch/i386/kernel/sysenter.c for elf.

I did a test calling arch_setup_additional_pages from fs/binfmt_aout.c with
positive result. 

As arch_setup_additional_pages is defined in arch/i368-asm/elf.h only, I see no
clean way to provide a patch for fs/binfmt_aout.c. 

Steps to reproduce:
Compile a simple program using sleep() to a.out binary and execute it. It will
sigsegv on delivery of SIGALRM.
Comment 1 Andrew Morton 2007-01-26 14:51:00 UTC
(Please respond via reply-to-all, not via the bugzilla web interface)

On Fri, 26 Jan 2007 14:40:09 -0800
bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=7891
> 
>            Summary: vdso page is no longer mapped for a.out binaries in
>                     kernel 2.6.18
>     Kernel Version: 2.6.18 and later
>             Status: NEW
>           Severity: normal
>              Owner: process_other@kernel-bugs.osdl.org
>          Submitter: joerg@hydrops.han.de
> 
> 
> Most recent kernel where this bug did *NOT* occur: 2.6.17.14
> Distribution: vanilla kernel
> Hardware Environment: x86-32
> Software Environment: gentoo
> Problem Description: this is a 2.6.18 regression bug.
> 
> In kernel 2.6.18 the vdso page is no longer mapped for a.out binaries.
> For instance a program using sleep will sigsegv on delivery of SIGALRM (to be
> precise: on return from signal handling). I tested this using a static a.out
> binary. This program does work in 2.6.17 . 
> 
> cat /proc/pid/smaps does show that vdso is not mapped in 2.6.18 for an a.out
> binary. I had a look at fs/binfmt_elf.c and found that the vdso pages is mapped
> using arch_setup_additional_pages from arch/i386/kernel/sysenter.c for elf.
> 
> I did a test calling arch_setup_additional_pages from fs/binfmt_aout.c with
> positive result. 
> 
> As arch_setup_additional_pages is defined in arch/i368-asm/elf.h only, I see no
> clean way to provide a patch for fs/binfmt_aout.c. 
> 
> Steps to reproduce:
> Compile a simple program using sleep() to a.out binary and execute it. It will
> sigsegv on delivery of SIGALRM.
> 

OK, who was it this time?  Andi?

If a.out indeed needs to call arch_setup_additional_pages() then the
correct way to fix this is to rip the festering dungpile which we have now
and:

- Give i386, x86_64, powerpc and sh a new
  CONFIG_ARCH_HAS_SETUP_ADDITIONAL_PAGES

- Create a new include/linux/interp.h which has:

	struct linux_binprm;
	#ifdef CONFIG_ARCH_HAS_SETUP_ADDITIONAL_PAGES
	extern int arch_setup_additional_pages(struct linux_binprm *bprm,
                                       int executable_stack);
	#else
	static inline int arch_setup_additional_pages(struct linux_binprm *bprm,
                                       int executable_stack)
	{
		return 0;
	}
	#endif

- include <linux/interp.h> from binfmt_elf.c and binfmt_aout.c and from
  all the files which implement arch_setup_additional_pages().  

- Remove the #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES from binfmt_elf.c

- Add the call to arch_setup_additional_pages() in binfmt_aout.h.


Comment 2 Daniel Drake 2007-01-26 15:22:00 UTC
original report https://bugs.gentoo.org/show_bug.cgi?id=159665
Comment 3 Daniel Drake 2007-03-07 05:31:16 UTC
What's the status of this bug? Has a fix made it into Linus' tree yet?
Comment 4 Daniel Drake 2007-03-13 05:39:56 UTC
should be fixed by commit 9fbbd4dd17d0712054368e5e939e28b2456bfe1b

Note You need to log in before you can comment on or make changes to this bug.