From: Parag Warudkar <parag.warudkar@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, ak@suse.de, joerg@hydrops.han.de,
dsd@gentoo.org, paulus@samba.org, benh@kernel.crashing.org,
lethal@linux-sh.org
Subject: [PATCH] Make aout executables work again
Date: Fri, 9 Feb 2007 21:31:45 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0702092100540.3984@localhost.localdomain> (raw)
This a reworked, replacement version of
x86-fix-vdso-mapping-for-aout-executables-* series of patches in -mm.
1) Define arch_setup_additional_pages() as weak in linux/interp.h
2) Include linux/interp.h in appropriate places
3) Conditionally call arch_setup_additional_pages() from binfmt_*.c if the
arch defines it
4) EXPORT_SYMBOL_GPL(arch_setup_additional_pages) for all x86{64},
powerpc, sh - binfmt_aout can be built as module
5) Get rid of ARCH_HAS_SETUP_ADDITIONAL_PAGES from various places
6) For x86_64 - define and export arch_setup_additional_pages as a wrapper
over syscall32_setup_pages, call it from ia32_aout.c
Fully tested on x86. (Compile, boot and run the aout binary at
http://ftp.funet.fi/pub/Linux/bin/as86.tar.Z). Other arches - changes are
minimal but still I'll appreciate if someone tests them.
Signed-off-by: Parag Warudkar <parag.warudkar@gmail.com>
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/arch/i386/kernel/sysenter.c linux-2.6-wk/arch/i386/kernel/sysenter.c
--- linux-2.6-us/arch/i386/kernel/sysenter.c 2007-02-09 17:29:34.000000000 -0500
+++ linux-2.6-wk/arch/i386/kernel/sysenter.c 2007-02-09 17:54:48.000000000 -0500
@@ -137,6 +137,7 @@
up_write(&mm->mmap_sem);
return ret;
}
+EXPORT_SYMBOL_GPL(arch_setup_additional_pages);
const char *arch_vma_name(struct vm_area_struct *vma)
{
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/arch/powerpc/kernel/vdso.c linux-2.6-wk/arch/powerpc/kernel/vdso.c
--- linux-2.6-us/arch/powerpc/kernel/vdso.c 2007-02-09 17:29:34.000000000 -0500
+++ linux-2.6-wk/arch/powerpc/kernel/vdso.c 2007-02-09 18:02:09.000000000 -0500
@@ -254,6 +254,7 @@
up_write(&mm->mmap_sem);
return rc;
}
+EXPORT_SYMBOL_GPL(arch_setup_additional_pages);
const char *arch_vma_name(struct vm_area_struct *vma)
{
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6-wk/arch/sh/kernel/vsyscall/vsyscall.c
--- linux-2.6-us/arch/sh/kernel/vsyscall/vsyscall.c 2007-02-09 17:29:34.000000000 -0500
+++ linux-2.6-wk/arch/sh/kernel/vsyscall/vsyscall.c 2007-02-09 18:02:51.000000000 -0500
@@ -85,6 +85,7 @@
up_write(&mm->mmap_sem);
return ret;
}
+EXPORT_SYMBOL_GPL(arch_setup_additional_pages);
const char *arch_vma_name(struct vm_area_struct *vma)
{
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/arch/x86_64/ia32/ia32_aout.c linux-2.6-wk/arch/x86_64/ia32/ia32_aout.c
--- linux-2.6-us/arch/x86_64/ia32/ia32_aout.c 2007-01-26 18:49:37.000000000 -0500
+++ linux-2.6-wk/arch/x86_64/ia32/ia32_aout.c 2007-02-09 20:29:01.000000000 -0500
@@ -23,6 +23,7 @@
#include <linux/user.h>
#include <linux/slab.h>
#include <linux/binfmts.h>
+#include <linux/interp.h>
#include <linux/personality.h>
#include <linux/init.h>
@@ -410,6 +411,12 @@
send_sig(SIGKILL, current, 0);
return retval;
}
+
+ retval = arch_setup_additional_pages(bprm, EXSTACK_DEFAULT);
+ if (retval < 0) {
+ send_sig(SIGKILL, current, 0);
+ return retval;
+ }
current->mm->start_stack =
(unsigned long)create_aout_tables((char __user *)bprm->p, bprm);
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/arch/x86_64/ia32/ia32_binfmt.c linux-2.6-wk/arch/x86_64/ia32/ia32_binfmt.c
--- linux-2.6-us/arch/x86_64/ia32/ia32_binfmt.c 2007-01-27 17:23:08.000000000 -0500
+++ linux-2.6-wk/arch/x86_64/ia32/ia32_binfmt.c 2007-02-09 17:58:42.000000000 -0500
@@ -258,10 +258,6 @@
static void elf32_init(struct pt_regs *);
-#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
-#define arch_setup_additional_pages syscall32_setup_pages
-extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
-
#include "../../../fs/binfmt_elf.c"
static void elf32_init(struct pt_regs *regs)
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/arch/x86_64/ia32/syscall32.c linux-2.6-wk/arch/x86_64/ia32/syscall32.c
--- linux-2.6-us/arch/x86_64/ia32/syscall32.c 2007-02-09 17:29:34.000000000 -0500
+++ linux-2.6-wk/arch/x86_64/ia32/syscall32.c 2007-02-09 18:01:23.000000000 -0500
@@ -48,6 +48,12 @@
return ret;
}
+int arch_setup_additional_pages(struct linux_binprm* bprm, int exstack)
+{
+ return syscall32_setup_pages(bprm, exstack);
+}
+EXPORT_SYMBOL_GPL(arch_setup_additional_pages);
+
const char *arch_vma_name(struct vm_area_struct *vma)
{
if (vma->vm_start == VSYSCALL32_BASE &&
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/fs/binfmt_aout.c linux-2.6-wk/fs/binfmt_aout.c
--- linux-2.6-us/fs/binfmt_aout.c 2007-01-26 18:49:39.000000000 -0500
+++ linux-2.6-wk/fs/binfmt_aout.c 2007-02-09 17:53:33.000000000 -0500
@@ -22,6 +22,7 @@
#include <linux/user.h>
#include <linux/slab.h>
#include <linux/binfmts.h>
+#include <linux/interp.h>
#include <linux/personality.h>
#include <linux/init.h>
@@ -445,6 +446,14 @@
send_sig(SIGKILL, current, 0);
return retval;
}
+
+ if(arch_setup_additional_pages) {
+ retval = arch_setup_additional_pages(bprm, EXSTACK_DEFAULT);
+ if (retval < 0) {
+ send_sig(SIGKILL, current, 0);
+ return retval;
+ }
+ }
current->mm->start_stack =
(unsigned long) create_aout_tables((char __user *) bprm->p, bprm);
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/fs/binfmt_elf.c linux-2.6-wk/fs/binfmt_elf.c
--- linux-2.6-us/fs/binfmt_elf.c 2007-01-27 17:23:08.000000000 -0500
+++ linux-2.6-wk/fs/binfmt_elf.c 2007-02-09 17:48:18.000000000 -0500
@@ -20,6 +20,7 @@
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/binfmts.h>
+#include <linux/interp.h>
#include <linux/string.h>
#include <linux/file.h>
#include <linux/fcntl.h>
@@ -974,13 +975,13 @@
set_binfmt(&elf_format);
-#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
- retval = arch_setup_additional_pages(bprm, executable_stack);
- if (retval < 0) {
- send_sig(SIGKILL, current, 0);
- goto out;
+ if (arch_setup_additional_pages) {
+ retval = arch_setup_additional_pages(bprm, executable_stack);
+ if (retval < 0) {
+ send_sig(SIGKILL, current, 0);
+ goto out;
+ }
}
-#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
compute_creds(bprm);
current->flags &= ~PF_FORKNOEXEC;
diff -urN --exclude='*git*' --exclude='scripts*' linux-2.6-us/include/linux/interp.h linux-2.6-wk/include/linux/interp.h
--- linux-2.6-us/include/linux/interp.h 1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6-wk/include/linux/interp.h 2007-02-09 21:26:34.000000000 -0500
@@ -0,0 +1,8 @@
+#ifndef _LINUX_INTERP_H
+#define _LINUX_INTERP_H
+
+struct linux_binprm;
+
+extern int __attribute__((weak))
+ arch_setup_additional_pages(struct linux_binprm*, int);
+#endif /* _LINUX_INTERP_H */
next reply other threads:[~2007-02-10 2:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-10 2:31 Parag Warudkar [this message]
2007-02-10 12:58 ` Andi Kleen
2007-02-10 13:50 ` Parag Warudkar
2007-02-10 14:24 ` Andi Kleen
2007-02-10 14:41 ` Parag Warudkar
2007-02-10 15:12 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0702092100540.3984@localhost.localdomain \
--to=parag.warudkar@gmail.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=dsd@gentoo.org \
--cc=joerg@hydrops.han.de \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®