[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191211071943.GA3700@avx2>
Date: Wed, 11 Dec 2019 10:19:43 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ELF: don't copy ELF header around
On Tue, Dec 10, 2019 at 05:56:11PM -0800, Andrew Morton wrote:
> On Sun, 8 Dec 2019 20:12:42 +0300 Alexey Dobriyan <adobriyan@...il.com> wrote:
>
> > ELF header is read into bprm->buf[] by generic execve code.
> >
> > Save a memcpy and allocate just one header for the interpreter instead
> > of two headers (64 bytes instead of 128 on 64-bit).
>
> Hard to review. Why were there two copies in the first place?
That's a good question. Both can live on stack in fact
but [rsp+disp32] addressing generates a lot of bloat (few KB).
> Because of the need to modify the caller's version when we do
> `loc->elf_ex.e_entry += load_bias', yes? Any other place?
No, but I'll double check. It was written this way presumably to not
allocate one more stack variable.
> Local variable `loc' can go away now, yes?
It can.
I have big plans to get rid of all allocations in the common case
and "fetch" headers from pagecache. This is why all headers better to be
"const" which this patch partially progresses to.
Powered by blists - more mailing lists