linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ELF: don't copy ELF header around
Date: Wed, 11 Dec 2019 10:19:43 +0300	[thread overview]
Message-ID: <20191211071943.GA3700@avx2> (raw)
In-Reply-To: <20191210175611.d615f21e177d5a550a8926f0@linux-foundation.org>

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@gmail.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.

      reply	other threads:[~2019-12-11  7:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-08 17:12 [PATCH] ELF: don't copy ELF header around Alexey Dobriyan
2019-12-11  1:56 ` Andrew Morton
2019-12-11  7:19   ` Alexey Dobriyan [this message]

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=20191211071943.GA3700@avx2 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).