Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread Adrian Bunk
On Wed, Nov 07, 2007 at 05:43:28PM +, David Howells wrote:

> Suppress A.OUT library support in ELF binfmt if CONFIG_BINFMT_AOUT is not set.
> 
> Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
> be permitted to go looking for A.OUT libraries to load in such a case.
>...

The a.out interpreter support for ELF executables is already scheduled
for being completely removed in 2.6.25.

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread David Howells
David Woodhouse <[EMAIL PROTECTED]> wrote:

> Ew, no. This is horridly broken. You should never use CONFIG_xxx_MODULE
> in the static kernel at all -- and you should _especially_ not be using
> it in header files which are exported to userspace.

AOUT support can be mostly built into a module, but a small part of it that is
arch-specific still gets built into the main kernel.  *That* is the main thing
that is wrong.

I suppose it might be possible to move those bits of the main kernel into
inline functions in asm/a.out.h and thus include them directly in
binfmt_aout.ko.

> This abomination certainly doesn't seem to have any direct relation to
> mn10300 support -- I think all you really need there is not to attempt
> to export {asm,linux}/a.out.h if asm/a.out.h doesn't exist, which is
> something you haven't attempted here anyway.

No, it's not that simple.  If asm/a.out.h doesn't exist, then various bits of
the kernel break that shouldn't.  fs/binfmt_elf.c for example.  fs/exec.c for
another.  They *expect* bits of the asm/a.out.h and linux/a.out.h to exist -
which they shouldn't.

Not exporting them isn't by itself sufficient.  The required constants
themselves are not defined for an arch that doesn't have the support, and so
the core code must not depend on them.  This patch fixes that.

Furthermore, STACK_TOP and STACK_TOP_MAX don't belong in asm/a.out.h as far as
I can tell.  They should probably be wherever TASK_SIZE resides (ie:
asm/processor.h).

David
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread David Woodhouse
On Wed, 2007-11-07 at 17:43 +, David Howells wrote:
> --- a/include/linux/a.out.h
> +++ b/include/linux/a.out.h
> @@ -1,6 +1,11 @@
>  #ifndef __A_OUT_GNU_H__
>  #define __A_OUT_GNU_H__
>  
> +#if defined(CONFIG_BINFMT_AOUT) || \
> +   defined(CONFIG_BINFMT_AOUT_MODULE) || \
> +   defined(CONFIG_IA32_AOUT) || \
> +   defined(CONFIG_IA32_AOUT_MODULE)
> +
>  #define __GNU_EXEC_MACROS__
>  
>  #ifndef __STRUCT_EXEC_OVERRIDE__

Ew, no. This is horridly broken. You should never use CONFIG_xxx_MODULE
in the static kernel at all -- and you should _especially_ not be using
it in header files which are exported to userspace.

This abomination certainly doesn't seem to have any direct relation to
mn10300 support -- I think all you really need there is not to attempt
to export {asm,linux}/a.out.h if asm/a.out.h doesn't exist, which is
something you haven't attempted here anyway.

-- 
dwmw2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread Mike Frysinger
On 11/7/07, David Howells <[EMAIL PROTECTED]> wrote:
>  arch/blackfin/kernel/bfin_ksyms.c   |1 -
>  arch/blackfin/kernel/process.c  |7 +--
>  include/asm-blackfin/a.out.h|6 --
>  include/asm-blackfin/processor.h|4 

we're going to opt to simply delete any a.out related code for
Blackfin ... i think Bryan has patches in the queue to do just that
...
-mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread David Howells
Suppress A.OUT library support in ELF binfmt if CONFIG_BINFMT_AOUT is not set.

Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
be permitted to go looking for A.OUT libraries to load in such a case.  Not
only that, but under such conditions A.OUT core dumps are not produced either.

To make this work, this patch also does the following:

 (1) Makes the existence of the contents of linux/a.out.h more or less
 contingent on CONFIG_BINFMT_AOUT=[ym] or CONFIG_IA32_AOUT=[ym].

 (2) Moves STACK_TOP[_MAX] out of asm/a.out.h and into asm/processor.h as
 they're required whether or not A.OUT format is available.

 (3) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT
 core dumping code.

 (4) Makes aout_dump_thread()'s existence contingent on
 CONFIG_BINFMT_AOUT=[ym].

I suspect certain other arches that have an aout_dump_thread() function can
dispense entirely with it as they don't and won't support A.OUT.

Signed-off-by: David Howells <[EMAIL PROTECTED]>
---

 arch/alpha/kernel/process.c |6 --
 arch/arm/kernel/process.c   |8 +---
 arch/blackfin/kernel/bfin_ksyms.c   |1 -
 arch/blackfin/kernel/process.c  |7 +--
 arch/m68k/kernel/process.c  |8 +---
 arch/sparc/kernel/process.c |7 +--
 arch/sparc/kernel/sparc_ksyms.c |2 --
 arch/sparc64/kernel/binfmt_aout32.c |2 +-
 arch/sparc64/kernel/binfmt_elf32.c  |2 --
 arch/sparc64/kernel/process.c   |6 --
 arch/sparc64/kernel/sparc64_ksyms.c |1 -
 arch/sparc64/kernel/sys_sparc.c |2 +-
 arch/sparc64/kernel/sys_sparc32.c   |2 +-
 arch/um/kernel/ksyms.c  |1 -
 arch/um/kernel/process.c|6 +-
 arch/x86/kernel/process_32.c|8 +---
 fs/binfmt_aout.c|2 +-
 fs/binfmt_elf.c |   30 ++
 fs/exec.c   |2 +-
 include/asm-alpha/a.out.h   |5 -
 include/asm-alpha/processor.h   |5 +
 include/asm-arm/a.out.h |6 --
 include/asm-arm/processor.h |6 ++
 include/asm-avr32/a.out.h   |7 ---
 include/asm-avr32/processor.h   |5 +
 include/asm-blackfin/a.out.h|6 --
 include/asm-blackfin/processor.h|4 
 include/asm-cris/a.out.h|6 --
 include/asm-cris/processor.h|3 +++
 include/asm-h8300/a.out.h   |7 ---
 include/asm-h8300/processor.h   |5 +
 include/asm-ia64/a.out.h|3 ---
 include/asm-m32r/a.out.h|7 ---
 include/asm-m32r/processor.h|5 +
 include/asm-m68k/a.out.h|7 ---
 include/asm-m68k/processor.h|5 +
 include/asm-mips/a.out.h|   13 -
 include/asm-mips/processor.h|7 +++
 include/asm-parisc/a.out.h  |   10 --
 include/asm-parisc/processor.h  |   10 ++
 include/asm-powerpc/a.out.h |   19 ---
 include/asm-powerpc/processor.h |   19 +++
 include/asm-s390/a.out.h|7 ---
 include/asm-s390/processor.h|7 +++
 include/asm-sh/a.out.h  |7 ---
 include/asm-sh/processor.h  |7 +++
 include/asm-sh64/a.out.h|7 ---
 include/asm-sparc/a.out.h   |9 -
 include/asm-sparc/processor.h   |4 
 include/asm-sparc64/a.out.h |   12 
 include/asm-sparc64/processor.h |   14 +-
 include/asm-sparc64/uaccess.h   |2 +-
 include/asm-sparc64/user.h  |2 +-
 include/asm-um/a.out.h  |   13 -
 include/asm-um/processor-generic.h  |8 
 include/asm-x86/a.out.h |   10 --
 include/asm-x86/processor_32.h  |2 ++
 include/asm-x86/processor_64.h  |2 ++
 include/asm-xtensa/a.out.h  |5 -
 include/asm-xtensa/processor.h  |2 ++
 include/linux/a.out.h   |   17 +
 include/linux/kernel.h  |2 --
 62 files changed, 203 insertions(+), 209 deletions(-)

diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 92b6162..e2e6593 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -320,8 +320,9 @@ copy_thread(int nr, unsigned long clone_flags, unsigned 
long usp,
 /*
  * Fill in the user structure for an ECOFF core dump.
  */
+#if defined(CONFIG_BINFMT_AOUT) || defined defined(CONFIG_BINFMT_AOUT_MODULE)
 void
-dump_thread(struct pt_regs * pt, struct user * dump)
+aout_dump_thread(struct pt_regs * pt, struct user * dump)
 {
/* switch stack follows right below pt_regs: */
struct switch_stack * sw = ((struct switch_stack *) pt) - 1;
@@ -377,7 +378,8 @@ dump_thread(struct pt_regs * pt, struct 

Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread Mike Frysinger
On 11/7/07, David Howells [EMAIL PROTECTED] wrote:
  arch/blackfin/kernel/bfin_ksyms.c   |1 -
  arch/blackfin/kernel/process.c  |7 +--
  include/asm-blackfin/a.out.h|6 --
  include/asm-blackfin/processor.h|4 

we're going to opt to simply delete any a.out related code for
Blackfin ... i think Bryan has patches in the queue to do just that
...
-mike
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread David Howells
Suppress A.OUT library support in ELF binfmt if CONFIG_BINFMT_AOUT is not set.

Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
be permitted to go looking for A.OUT libraries to load in such a case.  Not
only that, but under such conditions A.OUT core dumps are not produced either.

To make this work, this patch also does the following:

 (1) Makes the existence of the contents of linux/a.out.h more or less
 contingent on CONFIG_BINFMT_AOUT=[ym] or CONFIG_IA32_AOUT=[ym].

 (2) Moves STACK_TOP[_MAX] out of asm/a.out.h and into asm/processor.h as
 they're required whether or not A.OUT format is available.

 (3) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT
 core dumping code.

 (4) Makes aout_dump_thread()'s existence contingent on
 CONFIG_BINFMT_AOUT=[ym].

I suspect certain other arches that have an aout_dump_thread() function can
dispense entirely with it as they don't and won't support A.OUT.

Signed-off-by: David Howells [EMAIL PROTECTED]
---

 arch/alpha/kernel/process.c |6 --
 arch/arm/kernel/process.c   |8 +---
 arch/blackfin/kernel/bfin_ksyms.c   |1 -
 arch/blackfin/kernel/process.c  |7 +--
 arch/m68k/kernel/process.c  |8 +---
 arch/sparc/kernel/process.c |7 +--
 arch/sparc/kernel/sparc_ksyms.c |2 --
 arch/sparc64/kernel/binfmt_aout32.c |2 +-
 arch/sparc64/kernel/binfmt_elf32.c  |2 --
 arch/sparc64/kernel/process.c   |6 --
 arch/sparc64/kernel/sparc64_ksyms.c |1 -
 arch/sparc64/kernel/sys_sparc.c |2 +-
 arch/sparc64/kernel/sys_sparc32.c   |2 +-
 arch/um/kernel/ksyms.c  |1 -
 arch/um/kernel/process.c|6 +-
 arch/x86/kernel/process_32.c|8 +---
 fs/binfmt_aout.c|2 +-
 fs/binfmt_elf.c |   30 ++
 fs/exec.c   |2 +-
 include/asm-alpha/a.out.h   |5 -
 include/asm-alpha/processor.h   |5 +
 include/asm-arm/a.out.h |6 --
 include/asm-arm/processor.h |6 ++
 include/asm-avr32/a.out.h   |7 ---
 include/asm-avr32/processor.h   |5 +
 include/asm-blackfin/a.out.h|6 --
 include/asm-blackfin/processor.h|4 
 include/asm-cris/a.out.h|6 --
 include/asm-cris/processor.h|3 +++
 include/asm-h8300/a.out.h   |7 ---
 include/asm-h8300/processor.h   |5 +
 include/asm-ia64/a.out.h|3 ---
 include/asm-m32r/a.out.h|7 ---
 include/asm-m32r/processor.h|5 +
 include/asm-m68k/a.out.h|7 ---
 include/asm-m68k/processor.h|5 +
 include/asm-mips/a.out.h|   13 -
 include/asm-mips/processor.h|7 +++
 include/asm-parisc/a.out.h  |   10 --
 include/asm-parisc/processor.h  |   10 ++
 include/asm-powerpc/a.out.h |   19 ---
 include/asm-powerpc/processor.h |   19 +++
 include/asm-s390/a.out.h|7 ---
 include/asm-s390/processor.h|7 +++
 include/asm-sh/a.out.h  |7 ---
 include/asm-sh/processor.h  |7 +++
 include/asm-sh64/a.out.h|7 ---
 include/asm-sparc/a.out.h   |9 -
 include/asm-sparc/processor.h   |4 
 include/asm-sparc64/a.out.h |   12 
 include/asm-sparc64/processor.h |   14 +-
 include/asm-sparc64/uaccess.h   |2 +-
 include/asm-sparc64/user.h  |2 +-
 include/asm-um/a.out.h  |   13 -
 include/asm-um/processor-generic.h  |8 
 include/asm-x86/a.out.h |   10 --
 include/asm-x86/processor_32.h  |2 ++
 include/asm-x86/processor_64.h  |2 ++
 include/asm-xtensa/a.out.h  |5 -
 include/asm-xtensa/processor.h  |2 ++
 include/linux/a.out.h   |   17 +
 include/linux/kernel.h  |2 --
 62 files changed, 203 insertions(+), 209 deletions(-)

diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 92b6162..e2e6593 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -320,8 +320,9 @@ copy_thread(int nr, unsigned long clone_flags, unsigned 
long usp,
 /*
  * Fill in the user structure for an ECOFF core dump.
  */
+#if defined(CONFIG_BINFMT_AOUT) || defined defined(CONFIG_BINFMT_AOUT_MODULE)
 void
-dump_thread(struct pt_regs * pt, struct user * dump)
+aout_dump_thread(struct pt_regs * pt, struct user * dump)
 {
/* switch stack follows right below pt_regs: */
struct switch_stack * sw = ((struct switch_stack *) pt) - 1;
@@ -377,7 +378,8 @@ dump_thread(struct pt_regs * pt, struct 

Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread David Woodhouse
On Wed, 2007-11-07 at 17:43 +, David Howells wrote:
 --- a/include/linux/a.out.h
 +++ b/include/linux/a.out.h
 @@ -1,6 +1,11 @@
  #ifndef __A_OUT_GNU_H__
  #define __A_OUT_GNU_H__
  
 +#if defined(CONFIG_BINFMT_AOUT) || \
 +   defined(CONFIG_BINFMT_AOUT_MODULE) || \
 +   defined(CONFIG_IA32_AOUT) || \
 +   defined(CONFIG_IA32_AOUT_MODULE)
 +
  #define __GNU_EXEC_MACROS__
  
  #ifndef __STRUCT_EXEC_OVERRIDE__

Ew, no. This is horridly broken. You should never use CONFIG_xxx_MODULE
in the static kernel at all -- and you should _especially_ not be using
it in header files which are exported to userspace.

This abomination certainly doesn't seem to have any direct relation to
mn10300 support -- I think all you really need there is not to attempt
to export {asm,linux}/a.out.h if asm/a.out.h doesn't exist, which is
something you haven't attempted here anyway.

-- 
dwmw2

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread David Howells
David Woodhouse [EMAIL PROTECTED] wrote:

 Ew, no. This is horridly broken. You should never use CONFIG_xxx_MODULE
 in the static kernel at all -- and you should _especially_ not be using
 it in header files which are exported to userspace.

AOUT support can be mostly built into a module, but a small part of it that is
arch-specific still gets built into the main kernel.  *That* is the main thing
that is wrong.

I suppose it might be possible to move those bits of the main kernel into
inline functions in asm/a.out.h and thus include them directly in
binfmt_aout.ko.

 This abomination certainly doesn't seem to have any direct relation to
 mn10300 support -- I think all you really need there is not to attempt
 to export {asm,linux}/a.out.h if asm/a.out.h doesn't exist, which is
 something you haven't attempted here anyway.

No, it's not that simple.  If asm/a.out.h doesn't exist, then various bits of
the kernel break that shouldn't.  fs/binfmt_elf.c for example.  fs/exec.c for
another.  They *expect* bits of the asm/a.out.h and linux/a.out.h to exist -
which they shouldn't.

Not exporting them isn't by itself sufficient.  The required constants
themselves are not defined for an arch that doesn't have the support, and so
the core code must not depend on them.  This patch fixes that.

Furthermore, STACK_TOP and STACK_TOP_MAX don't belong in asm/a.out.h as far as
I can tell.  They should probably be wherever TASK_SIZE resides (ie:
asm/processor.h).

David
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Suppress A.OUT library support in ELF binfmt if !CONFIG_BINFMT_AOUT [try #3]

2007-11-07 Thread Adrian Bunk
On Wed, Nov 07, 2007 at 05:43:28PM +, David Howells wrote:

 Suppress A.OUT library support in ELF binfmt if CONFIG_BINFMT_AOUT is not set.
 
 Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
 be permitted to go looking for A.OUT libraries to load in such a case.
...

The a.out interpreter support for ELF executables is already scheduled
for being completely removed in 2.6.25.

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/