Re: [PATCH] elf loader support for auxvec base platform string

From: Nathan Lynch
Date: Thu Jul 17 2008 - 13:39:52 EST


Andrew Morton wrote:
> > On Tue, 2008-07-15 at 18:58 -0500, Nathan Lynch wrote:
> > > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> > > index d48ff5f..834c2c4 100644
> > > --- a/fs/binfmt_elf.c
> > > +++ b/fs/binfmt_elf.c
> > > @@ -131,6 +131,10 @@ static int padzero(unsigned long elf_bss)
> > > #define STACK_ALLOC(sp, len) ({ sp -= len ; sp; })
> > > #endif
> > >
> > > +#ifndef ELF_BASE_PLATFORM
> > > +#define ELF_BASE_PLATFORM NULL
> > > +#endif
>
> Please add a comment which explains what this is.
>
> Please also add a comment telling the world in which header file the
> architecture *must* define this macro and then ensure that that header is
> included into this file by reliable means. asm/elf.h looks OK.

Okay.


> > > @@ -172,6 +178,19 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
> > > return -EFAULT;
> > > }
> > >
> > > + /*
> > > + * If this architecture has a "base" platform capability
> > > + * string, copy it to userspace.
> > > + */
> > > + u_base_platform = NULL;
> > > + if (k_base_platform) {
> > > + size_t len = strlen(k_base_platform) + 1;
> > > +
> > > + u_base_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
> > > + if (__copy_to_user(u_base_platform, k_base_platform, len))
> > > + return -EFAULT;
> > > + }
>
> >From my reading, this change will result in no additional code
> generation on non-powerpc architectures. This is good. If poss, could
> you please verify that theory and perhaps drop a note in the changelog
> about that?

That was the intent, yes. However:

$ scripts/bloat-o-meter vmlinux-x86-{before,after}
add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0 (18)
function old new delta
init_mm 784 800 +16
load_elf_binary 11946 11948 +2

(x86_64_defconfig, gcc 4.2.3)

The init_mm/mm_struct bloat is expected (although I'd like to avoid
that), but evidently it has some small effect on load_elf_binary.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/