linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tony.luck@intel.com, jdike@addtoit.com, dhowells@redhat.com,
	gerg@snapgear.com, roland@redhat.com, oleg@redhat.com,
	mingo@elte.hu, viro@zeniv.linux.org.uk, andi@firstfloor.org,
	alan@lxorguk.ukuu.org.uk, akpm@linux-foundation.org,
	kosaki.motohiro@jp.fujitsu.com, kamezawa.hiroyu@jp.fujitsu.com,
	suzuki@in.ibm.com, linux-arch@vger.kernel.org
Subject: [PATCH 0/4] elf core: Write section header table first
Date: Thu, 30 Dec 2010 06:16:17 +0900	[thread overview]
Message-ID: <AANLkTimK9gh_LVW2faCbVMpwMeBFOJLRXHJkA4_3Oi6=@mail.gmail.com> (raw)

This patchset changes a position of section header table, if exists,
from the last to the next to ELF header. According to ELF
specification, the order of ELF component layout is not specified
except for ELF header. See:

  http://www.sco.com/developers/gabi/latest/ch4.intro.html#file_format

The merits are:
 - reducing tracing memory maps from 3 times to 2 times.
 - simple offset handling that makes the code easier to read.

 arch/ia64/kernel/elfcore.c |   16 -----
 arch/um/sys-i386/elfcore.c |   16 -----
 fs/binfmt_elf.c            |  136 +++++++++++++++++-------------------------
 fs/binfmt_elf_fdpic.c      |  141 ++++++++++++++++++--------------------------
 include/linux/elfcore.h    |    1 -
 kernel/elfcore.c           |    5 --
 6 files changed, 111 insertions(+), 204 deletions(-)

I built and tested this patchset on x86_64. I also built it on ia64,
um-i386 and frv using cross compilers to cover the range.

Here's a program useful to generate ELF core with many program header
entries, and three steps to produce such ELF core:

 $ sysctl vm.max_map_count=70000
 $ ulimit -c unlimted
 $ mkmmap 65535

== mkmmap.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char **argv)
{
        int maps_num;
        if (argc < 2) {
                fprintf(stderr, "mkmmaps [number of maps to be created]\n");
                exit(1);
        }
        if (sscanf(argv[1], "%d", &maps_num) == EOF) {
                perror("sscanf");
                exit(2);
        }
        if (maps_num < 0) {
                fprintf(stderr, "%d is invalid\n", maps_num);
                exit(3);
        }
        for (; maps_num > 0; --maps_num) {
                if (MAP_FAILED == mmap((void *)NULL, (size_t) 1, PROT_READ,
                                       MAP_SHARED | MAP_ANONYMOUS, (int) -1,
                                       (off_t) NULL)) {
                        perror("mmap");
                        exit(4);
                }
        }
        abort();
        {
                char buffer[128];
                sprintf(buffer, "wc -l /proc/%u/maps", getpid());
                system(buffer);
        }
        return 0;
}
==

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>

             reply	other threads:[~2010-12-29 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-29 21:16 HATAYAMA Daisuke [this message]
2010-12-29 21:19 ` [PATCH 1/4] elf core: Write section header table first HATAYAMA Daisuke
2011-01-04  1:02 ` [PATCH 0/4] " KAMEZAWA Hiroyuki

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='AANLkTimK9gh_LVW2faCbVMpwMeBFOJLRXHJkA4_3Oi6=@mail.gmail.com' \
    --to=d.hatayama@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=dhowells@redhat.com \
    --cc=gerg@snapgear.com \
    --cc=jdike@addtoit.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=suzuki@in.ibm.com \
    --cc=tony.luck@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).