linux/fs/binfmt_elf_fdpic.c
<<
>>
Prefs
   1/* binfmt_elf_fdpic.c: FDPIC ELF binary format
   2 *
   3 * Copyright (C) 2003, 2004, 2006 Red Hat, Inc. All Rights Reserved.
   4 * Written by David Howells (dhowells@redhat.com)
   5 * Derived from binfmt_elf.c
   6 *
   7 * This program is free software; you can redistribute it and/or
   8 * modify it under the terms of the GNU General Public License
   9 * as published by the Free Software Foundation; either version
  10 * 2 of the License, or (at your option) any later version.
  11 */
  12
  13#include <linux/module.h>
  14
  15#include <linux/fs.h>
  16#include <linux/stat.h>
  17#include <linux/sched.h>
  18#include <linux/mm.h>
  19#include <linux/mman.h>
  20#include <linux/errno.h>
  21#include <linux/signal.h>
  22#include <linux/binfmts.h>
  23#include <linux/string.h>
  24#include <linux/file.h>
  25#include <linux/fcntl.h>
  26#include <linux/slab.h>
  27#include <linux/pagemap.h>
  28#include <linux/security.h>
  29#include <linux/highmem.h>
  30#include <linux/highuid.h>
  31#include <linux/personality.h>
  32#include <linux/ptrace.h>
  33#include <linux/init.h>
  34#include <linux/elf.h>
  35#include <linux/elf-fdpic.h>
  36#include <linux/elfcore.h>
  37#include <linux/coredump.h>
  38
  39#include <asm/uaccess.h>
  40#include <asm/param.h>
  41#include <asm/pgalloc.h>
  42
  43typedef char *elf_caddr_t;
  44
  45#if 0
  46#define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ )
  47#else
  48#define kdebug(fmt, ...) do {} while(0)
  49#endif
  50
  51#if 0
  52#define kdcore(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ )
  53#else
  54#define kdcore(fmt, ...) do {} while(0)
  55#endif
  56
  57MODULE_LICENSE("GPL");
  58
  59static int load_elf_fdpic_binary(struct linux_binprm *, struct pt_regs *);
  60static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *, struct file *);
  61static int elf_fdpic_map_file(struct elf_fdpic_params *, struct file *,
  62                              struct mm_struct *, const char *);
  63
  64static int create_elf_fdpic_tables(struct linux_binprm *, struct mm_struct *,
  65                                   struct elf_fdpic_params *,
  66                                   struct elf_fdpic_params *);
  67
  68#ifndef CONFIG_MMU
  69static int elf_fdpic_transfer_args_to_stack(struct linux_binprm *,
  70                                            unsigned long *);
  71static int elf_fdpic_map_file_constdisp_on_uclinux(struct elf_fdpic_params *,
  72                                                   struct file *,
  73                                                   struct mm_struct *);
  74#endif
  75
  76static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *,
  77                                             struct file *, struct mm_struct *);
  78
  79#ifdef CONFIG_ELF_CORE
  80static int elf_fdpic_core_dump(struct coredump_params *cprm);
  81#endif
  82
  83static struct linux_binfmt elf_fdpic_format = {
  84        .module         = THIS_MODULE,
  85        .load_binary    = load_elf_fdpic_binary,
  86#ifdef CONFIG_ELF_CORE
  87        .core_dump      = elf_fdpic_core_dump,
  88#endif
  89        .min_coredump   = ELF_EXEC_PAGESIZE,
  90};
  91
  92static int __init init_elf_fdpic_binfmt(void)
  93{
  94        register_binfmt(&elf_fdpic_format);
  95        return 0;
  96}
  97
  98static void __exit exit_elf_fdpic_binfmt(void)
  99{
 100        unregister_binfmt(&elf_fdpic_format);
 101}
 102
 103core_initcall(init_elf_fdpic_binfmt);
 104module_exit(exit_elf_fdpic_binfmt);
 105
 106static int is_elf_fdpic(struct elfhdr *hdr, struct file *file)
 107{
 108        if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0)
 109                return 0;
 110        if (hdr->e_type != ET_EXEC && hdr->e_type != ET_DYN)
 111                return 0;
 112        if (!elf_check_arch(hdr) || !elf_check_fdpic(hdr))
 113                return 0;
 114        if (!file->f_op || !file->f_op->mmap)
 115                return 0;
 116        return 1;
 117}
 118
 119/*****************************************************************************/
 120/*
 121 * read the program headers table into memory
 122 */
 123static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *params,
 124                                 struct file *file)
 125{
 126        struct elf32_phdr *phdr;
 127        unsigned long size;
 128        int retval, loop;
 129
 130        if (params->hdr.e_phentsize != sizeof(struct elf_phdr))
 131                return -ENOMEM;
 132        if (params->hdr.e_phnum > 65536U / sizeof(struct elf_phdr))
 133                return -ENOMEM;
 134
 135        size = params->hdr.e_phnum * sizeof(struct elf_phdr);
 136        params->phdrs = kmalloc(size, GFP_KERNEL);
 137        if (!params->phdrs)
 138                return -ENOMEM;
 139
 140        retval = kernel_read(file, params->hdr.e_phoff,
 141                             (char *) params->phdrs, size);
 142        if (unlikely(retval != size))
 143                return retval < 0 ? retval : -ENOEXEC;
 144
 145        /* determine stack size for this binary */
 146        phdr = params->phdrs;
 147        for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
 148                if (phdr->p_type != PT_GNU_STACK)
 149                        continue;
 150
 151                if (phdr->p_flags & PF_X)
 152                        params->flags |= ELF_FDPIC_FLAG_EXEC_STACK;
 153                else
 154                        params->flags |= ELF_FDPIC_FLAG_NOEXEC_STACK;
 155
 156                params->stack_size = phdr->p_memsz;
 157                break;
 158        }
 159
 160        return 0;
 161}
 162
 163/*****************************************************************************/
 164/*
 165 * load an fdpic binary into various bits of memory
 166 */
 167static int load_elf_fdpic_binary(struct linux_binprm *bprm,
 168                                 struct pt_regs *regs)
 169{
 170        struct elf_fdpic_params exec_params, interp_params;
 171        struct elf_phdr *phdr;
 172        unsigned long stack_size, entryaddr;
 173#ifdef ELF_FDPIC_PLAT_INIT
 174        unsigned long dynaddr;
 175#endif
 176#ifndef CONFIG_MMU
 177        unsigned long stack_prot;
 178#endif
 179        struct file *interpreter = NULL; /* to shut gcc up */
 180        char *interpreter_name = NULL;
 181        int executable_stack;
 182        int retval, i;
 183
 184        kdebug("____ LOAD %d ____", current->pid);
 185
 186        memset(&exec_params, 0, sizeof(exec_params));
 187        memset(&interp_params, 0, sizeof(interp_params));
 188
 189        exec_params.hdr = *(struct elfhdr *) bprm->buf;
 190        exec_params.flags = ELF_FDPIC_FLAG_PRESENT | ELF_FDPIC_FLAG_EXECUTABLE;
 191
 192        /* check that this is a binary we know how to deal with */
 193        retval = -ENOEXEC;
 194        if (!is_elf_fdpic(&exec_params.hdr, bprm->file))
 195                goto error;
 196
 197        /* read the program header table */
 198        retval = elf_fdpic_fetch_phdrs(&exec_params, bprm->file);
 199        if (retval < 0)
 200                goto error;
 201
 202        /* scan for a program header that specifies an interpreter */
 203        phdr = exec_params.phdrs;
 204
 205        for (i = 0; i < exec_params.hdr.e_phnum; i++, phdr++) {
 206                switch (phdr->p_type) {
 207                case PT_INTERP:
 208                        retval = -ENOMEM;
 209                        if (phdr->p_filesz > PATH_MAX)
 210                                goto error;
 211                        retval = -ENOENT;
 212                        if (phdr->p_filesz < 2)
 213                                goto error;
 214
 215                        /* read the name of the interpreter into memory */
 216                        interpreter_name = kmalloc(phdr->p_filesz, GFP_KERNEL);
 217                        if (!interpreter_name)
 218                                goto error;
 219
 220                        retval = kernel_read(bprm->file,
 221                                             phdr->p_offset,
 222                                             interpreter_name,
 223                                             phdr->p_filesz);
 224                        if (unlikely(retval != phdr->p_filesz)) {
 225                                if (retval >= 0)
 226                                        retval = -ENOEXEC;
 227                                goto error;
 228                        }
 229
 230                        retval = -ENOENT;
 231                        if (interpreter_name[phdr->p_filesz - 1] != '\0')
 232                                goto error;
 233
 234                        kdebug("Using ELF interpreter %s", interpreter_name);
 235
 236                        /* replace the program with the interpreter */
 237                        interpreter = open_exec(interpreter_name);
 238                        retval = PTR_ERR(interpreter);
 239                        if (IS_ERR(interpreter)) {
 240                                interpreter = NULL;
 241                                goto error;
 242                        }
 243
 244                        /*
 245                         * If the binary is not readable then enforce
 246                         * mm->dumpable = 0 regardless of the interpreter's
 247                         * permissions.
 248                         */
 249                        would_dump(bprm, interpreter);
 250
 251                        retval = kernel_read(interpreter, 0, bprm->buf,
 252                                             BINPRM_BUF_SIZE);
 253                        if (unlikely(retval != BINPRM_BUF_SIZE)) {
 254                                if (retval >= 0)
 255                                        retval = -ENOEXEC;
 256                                goto error;
 257                        }
 258
 259                        interp_params.hdr = *((struct elfhdr *) bprm->buf);
 260                        break;
 261
 262                case PT_LOAD:
 263#ifdef CONFIG_MMU
 264                        if (exec_params.load_addr == 0)
 265                                exec_params.load_addr = phdr->p_vaddr;
 266#endif
 267                        break;
 268                }
 269
 270        }
 271
 272        if (elf_check_const_displacement(&exec_params.hdr))
 273                exec_params.flags |= ELF_FDPIC_FLAG_CONSTDISP;
 274
 275        /* perform insanity checks on the interpreter */
 276        if (interpreter_name) {
 277                retval = -ELIBBAD;
 278                if (!is_elf_fdpic(&interp_params.hdr, interpreter))
 279                        goto error;
 280
 281                interp_params.flags = ELF_FDPIC_FLAG_PRESENT;
 282
 283                /* read the interpreter's program header table */
 284                retval = elf_fdpic_fetch_phdrs(&interp_params, interpreter);
 285                if (retval < 0)
 286                        goto error;
 287        }
 288
 289        stack_size = exec_params.stack_size;
 290        if (exec_params.flags & ELF_FDPIC_FLAG_EXEC_STACK)
 291                executable_stack = EXSTACK_ENABLE_X;
 292        else if (exec_params.flags & ELF_FDPIC_FLAG_NOEXEC_STACK)
 293                executable_stack = EXSTACK_DISABLE_X;
 294        else
 295                executable_stack = EXSTACK_DEFAULT;
 296
 297        if (stack_size == 0) {
 298                stack_size = interp_params.stack_size;
 299                if (interp_params.flags & ELF_FDPIC_FLAG_EXEC_STACK)
 300                        executable_stack = EXSTACK_ENABLE_X;
 301                else if (interp_params.flags & ELF_FDPIC_FLAG_NOEXEC_STACK)
 302                        executable_stack = EXSTACK_DISABLE_X;
 303                else
 304                        executable_stack = EXSTACK_DEFAULT;
 305        }
 306
 307        retval = -ENOEXEC;
 308        if (stack_size == 0)
 309                goto error;
 310
 311        if (elf_check_const_displacement(&interp_params.hdr))
 312                interp_params.flags |= ELF_FDPIC_FLAG_CONSTDISP;
 313
 314        /* flush all traces of the currently running executable */
 315        retval = flush_old_exec(bprm);
 316        if (retval)
 317                goto error;
 318
 319        /* there's now no turning back... the old userspace image is dead,
 320         * defunct, deceased, etc. after this point we have to exit via
 321         * error_kill */
 322        set_personality(PER_LINUX_FDPIC);
 323        if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
 324                current->personality |= READ_IMPLIES_EXEC;
 325
 326        setup_new_exec(bprm);
 327
 328        set_binfmt(&elf_fdpic_format);
 329
 330        current->mm->start_code = 0;
 331        current->mm->end_code = 0;
 332        current->mm->start_stack = 0;
 333        current->mm->start_data = 0;
 334        current->mm->end_data = 0;
 335        current->mm->context.exec_fdpic_loadmap = 0;
 336        current->mm->context.interp_fdpic_loadmap = 0;
 337
 338#ifdef CONFIG_MMU
 339        elf_fdpic_arch_lay_out_mm(&exec_params,
 340                                  &interp_params,
 341                                  &current->mm->start_stack,
 342                                  &current->mm->start_brk);
 343
 344        retval = setup_arg_pages(bprm, current->mm->start_stack,
 345                                 executable_stack);
 346        if (retval < 0) {
 347                send_sig(SIGKILL, current, 0);
 348                goto error_kill;
 349        }
 350#endif
 351
 352        /* load the executable and interpreter into memory */
 353        retval = elf_fdpic_map_file(&exec_params, bprm->file, current->mm,
 354                                    "executable");
 355        if (retval < 0)
 356                goto error_kill;
 357
 358        if (interpreter_name) {
 359                retval = elf_fdpic_map_file(&interp_params, interpreter,
 360                                            current->mm, "interpreter");
 361                if (retval < 0) {
 362                        printk(KERN_ERR "Unable to load interpreter\n");
 363                        goto error_kill;
 364                }
 365
 366                allow_write_access(interpreter);
 367                fput(interpreter);
 368                interpreter = NULL;
 369        }
 370
 371#ifdef CONFIG_MMU
 372        if (!current->mm->start_brk)
 373                current->mm->start_brk = current->mm->end_data;
 374
 375        current->mm->brk = current->mm->start_brk =
 376                PAGE_ALIGN(current->mm->start_brk);
 377
 378#else
 379        /* create a stack and brk area big enough for everyone
 380         * - the brk heap starts at the bottom and works up
 381         * - the stack starts at the top and works down
 382         */
 383        stack_size = (stack_size + PAGE_SIZE - 1) & PAGE_MASK;
 384        if (stack_size < PAGE_SIZE * 2)
 385                stack_size = PAGE_SIZE * 2;
 386
 387        stack_prot = PROT_READ | PROT_WRITE;
 388        if (executable_stack == EXSTACK_ENABLE_X ||
 389            (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC))
 390                stack_prot |= PROT_EXEC;
 391
 392        current->mm->start_brk = vm_mmap(NULL, 0, stack_size, stack_prot,
 393                                         MAP_PRIVATE | MAP_ANONYMOUS |
 394                                         MAP_UNINITIALIZED | MAP_GROWSDOWN,
 395                                         0);
 396
 397        if (IS_ERR_VALUE(current->mm->start_brk)) {
 398                retval = current->mm->start_brk;
 399                current->mm->start_brk = 0;
 400                goto error_kill;
 401        }
 402
 403        current->mm->brk = current->mm->start_brk;
 404        current->mm->context.end_brk = current->mm->start_brk;
 405        current->mm->context.end_brk +=
 406                (stack_size > PAGE_SIZE) ? (stack_size - PAGE_SIZE) : 0;
 407        current->mm->start_stack = current->mm->start_brk + stack_size;
 408#endif
 409
 410        install_exec_creds(bprm);
 411        if (create_elf_fdpic_tables(bprm, current->mm,
 412                                    &exec_params, &interp_params) < 0)
 413                goto error_kill;
 414
 415        kdebug("- start_code  %lx", current->mm->start_code);
 416        kdebug("- end_code    %lx", current->mm->end_code);
 417        kdebug("- start_data  %lx", current->mm->start_data);
 418        kdebug("- end_data    %lx", current->mm->end_data);
 419        kdebug("- start_brk   %lx", current->mm->start_brk);
 420        kdebug("- brk         %lx", current->mm->brk);
 421        kdebug("- start_stack %lx", current->mm->start_stack);
 422
 423#ifdef ELF_FDPIC_PLAT_INIT
 424        /*
 425         * The ABI may specify that certain registers be set up in special
 426         * ways (on i386 %edx is the address of a DT_FINI function, for
 427         * example.  This macro performs whatever initialization to
 428         * the regs structure is required.
 429         */
 430        dynaddr = interp_params.dynamic_addr ?: exec_params.dynamic_addr;
 431        ELF_FDPIC_PLAT_INIT(regs, exec_params.map_addr, interp_params.map_addr,
 432                            dynaddr);
 433#endif
 434
 435        /* everything is now ready... get the userspace context ready to roll */
 436        entryaddr = interp_params.entry_addr ?: exec_params.entry_addr;
 437        start_thread(regs, entryaddr, current->mm->start_stack);
 438
 439        retval = 0;
 440
 441error:
 442        if (interpreter) {
 443                allow_write_access(interpreter);
 444                fput(interpreter);
 445        }
 446        kfree(interpreter_name);
 447        kfree(exec_params.phdrs);
 448        kfree(exec_params.loadmap);
 449        kfree(interp_params.phdrs);
 450        kfree(interp_params.loadmap);
 451        return retval;
 452
 453        /* unrecoverable error - kill the process */
 454error_kill:
 455        send_sig(SIGSEGV, current, 0);
 456        goto error;
 457
 458}
 459
 460/*****************************************************************************/
 461
 462#ifndef ELF_BASE_PLATFORM
 463/*
 464 * AT_BASE_PLATFORM indicates the "real" hardware/microarchitecture.
 465 * If the arch defines ELF_BASE_PLATFORM (in asm/elf.h), the value
 466 * will be copied to the user stack in the same manner as AT_PLATFORM.
 467 */
 468#define ELF_BASE_PLATFORM NULL
 469#endif
 470
 471/*
 472 * present useful information to the program by shovelling it onto the new
 473 * process's stack
 474 */
 475static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 476                                   struct mm_struct *mm,
 477                                   struct elf_fdpic_params *exec_params,
 478                                   struct elf_fdpic_params *interp_params)
 479{
 480        const struct cred *cred = current_cred();
 481        unsigned long sp, csp, nitems;
 482        elf_caddr_t __user *argv, *envp;
 483        size_t platform_len = 0, len;
 484        char *k_platform, *k_base_platform;
 485        char __user *u_platform, *u_base_platform, *p;
 486        long hwcap;
 487        int loop;
 488        int nr; /* reset for each csp adjustment */
 489
 490#ifdef CONFIG_MMU
 491        /* In some cases (e.g. Hyper-Threading), we want to avoid L1 evictions
 492         * by the processes running on the same package. One thing we can do is
 493         * to shuffle the initial stack for them, so we give the architecture
 494         * an opportunity to do so here.
 495         */
 496        sp = arch_align_stack(bprm->p);
 497#else
 498        sp = mm->start_stack;
 499
 500        /* stack the program arguments and environment */
 501        if (elf_fdpic_transfer_args_to_stack(bprm, &sp) < 0)
 502                return -EFAULT;
 503#endif
 504
 505        hwcap = ELF_HWCAP;
 506
 507        /*
 508         * If this architecture has a platform capability string, copy it
 509         * to userspace.  In some cases (Sparc), this info is impossible
 510         * for userspace to get any other way, in others (i386) it is
 511         * merely difficult.
 512         */
 513        k_platform = ELF_PLATFORM;
 514        u_platform = NULL;
 515
 516        if (k_platform) {
 517                platform_len = strlen(k_platform) + 1;
 518                sp -= platform_len;
 519                u_platform = (char __user *) sp;
 520                if (__copy_to_user(u_platform, k_platform, platform_len) != 0)
 521                        return -EFAULT;
 522        }
 523
 524        /*
 525         * If this architecture has a "base" platform capability
 526         * string, copy it to userspace.
 527         */
 528        k_base_platform = ELF_BASE_PLATFORM;
 529        u_base_platform = NULL;
 530
 531        if (k_base_platform) {
 532                platform_len = strlen(k_base_platform) + 1;
 533                sp -= platform_len;
 534                u_base_platform = (char __user *) sp;
 535                if (__copy_to_user(u_base_platform, k_base_platform, platform_len) != 0)
 536                        return -EFAULT;
 537        }
 538
 539        sp &= ~7UL;
 540
 541        /* stack the load map(s) */
 542        len = sizeof(struct elf32_fdpic_loadmap);
 543        len += sizeof(struct elf32_fdpic_loadseg) * exec_params->loadmap->nsegs;
 544        sp = (sp - len) & ~7UL;
 545        exec_params->map_addr = sp;
 546
 547        if (copy_to_user((void __user *) sp, exec_params->loadmap, len) != 0)
 548                return -EFAULT;
 549
 550        current->mm->context.exec_fdpic_loadmap = (unsigned long) sp;
 551
 552        if (interp_params->loadmap) {
 553                len = sizeof(struct elf32_fdpic_loadmap);
 554                len += sizeof(struct elf32_fdpic_loadseg) *
 555                        interp_params->loadmap->nsegs;
 556                sp = (sp - len) & ~7UL;
 557                interp_params->map_addr = sp;
 558
 559                if (copy_to_user((void __user *) sp, interp_params->loadmap,
 560                                 len) != 0)
 561                        return -EFAULT;
 562
 563                current->mm->context.interp_fdpic_loadmap = (unsigned long) sp;
 564        }
 565
 566        /* force 16 byte _final_ alignment here for generality */
 567#define DLINFO_ITEMS 15
 568
 569        nitems = 1 + DLINFO_ITEMS + (k_platform ? 1 : 0) +
 570                (k_base_platform ? 1 : 0) + AT_VECTOR_SIZE_ARCH;
 571
 572        if (bprm->interp_flags & BINPRM_FLAGS_EXECFD)
 573                nitems++;
 574
 575        csp = sp;
 576        sp -= nitems * 2 * sizeof(unsigned long);
 577        sp -= (bprm->envc + 1) * sizeof(char *);        /* envv[] */
 578        sp -= (bprm->argc + 1) * sizeof(char *);        /* argv[] */
 579        sp -= 1 * sizeof(unsigned long);                /* argc */
 580
 581        csp -= sp & 15UL;
 582        sp -= sp & 15UL;
 583
 584        /* put the ELF interpreter info on the stack */
 585#define NEW_AUX_ENT(id, val)                                            \
 586        do {                                                            \
 587                struct { unsigned long _id, _val; } __user *ent;        \
 588                                                                        \
 589                ent = (void __user *) csp;                              \
 590                __put_user((id), &ent[nr]._id);                         \
 591                __put_user((val), &ent[nr]._val);                       \
 592                nr++;                                                   \
 593        } while (0)
 594
 595        nr = 0;
 596        csp -= 2 * sizeof(unsigned long);
 597        NEW_AUX_ENT(AT_NULL, 0);
 598        if (k_platform) {
 599                nr = 0;
 600                csp -= 2 * sizeof(unsigned long);
 601                NEW_AUX_ENT(AT_PLATFORM,
 602                            (elf_addr_t) (unsigned long) u_platform);
 603        }
 604
 605        if (k_base_platform) {
 606                nr = 0;
 607                csp -= 2 * sizeof(unsigned long);
 608                NEW_AUX_ENT(AT_BASE_PLATFORM,
 609                            (elf_addr_t) (unsigned long) u_base_platform);
 610        }
 611
 612        if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) {
 613                nr = 0;
 614                csp -= 2 * sizeof(unsigned long);
 615                NEW_AUX_ENT(AT_EXECFD, bprm->interp_data);
 616        }
 617
 618        nr = 0;
 619        csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
 620        NEW_AUX_ENT(AT_HWCAP,   hwcap);
 621        NEW_AUX_ENT(AT_PAGESZ,  PAGE_SIZE);
 622        NEW_AUX_ENT(AT_CLKTCK,  CLOCKS_PER_SEC);
 623        NEW_AUX_ENT(AT_PHDR,    exec_params->ph_addr);
 624        NEW_AUX_ENT(AT_PHENT,   sizeof(struct elf_phdr));
 625        NEW_AUX_ENT(AT_PHNUM,   exec_params->hdr.e_phnum);
 626        NEW_AUX_ENT(AT_BASE,    interp_params->elfhdr_addr);
 627        NEW_AUX_ENT(AT_FLAGS,   0);
 628        NEW_AUX_ENT(AT_ENTRY,   exec_params->entry_addr);
 629        NEW_AUX_ENT(AT_UID,     (elf_addr_t) from_kuid_munged(cred->user_ns, cred->uid));
 630        NEW_AUX_ENT(AT_EUID,    (elf_addr_t) from_kuid_munged(cred->user_ns, cred->euid));
 631        NEW_AUX_ENT(AT_GID,     (elf_addr_t) from_kgid_munged(cred->user_ns, cred->gid));
 632        NEW_AUX_ENT(AT_EGID,    (elf_addr_t) from_kgid_munged(cred->user_ns, cred->egid));
 633        NEW_AUX_ENT(AT_SECURE,  security_bprm_secureexec(bprm));
 634        NEW_AUX_ENT(AT_EXECFN,  bprm->exec);
 635
 636#ifdef ARCH_DLINFO
 637        nr = 0;
 638        csp -= AT_VECTOR_SIZE_ARCH * 2 * sizeof(unsigned long);
 639
 640        /* ARCH_DLINFO must come last so platform specific code can enforce
 641         * special alignment requirements on the AUXV if necessary (eg. PPC).
 642         */
 643        ARCH_DLINFO;
 644#endif
 645#undef NEW_AUX_ENT
 646
 647        /* allocate room for argv[] and envv[] */
 648        csp -= (bprm->envc + 1) * sizeof(elf_caddr_t);
 649        envp = (elf_caddr_t __user *) csp;
 650        csp -= (bprm->argc + 1) * sizeof(elf_caddr_t);
 651        argv = (elf_caddr_t __user *) csp;
 652
 653        /* stack argc */
 654        csp -= sizeof(unsigned long);
 655        __put_user(bprm->argc, (unsigned long __user *) csp);
 656
 657        BUG_ON(csp != sp);
 658
 659        /* fill in the argv[] array */
 660#ifdef CONFIG_MMU
 661        current->mm->arg_start = bprm->p;
 662#else
 663        current->mm->arg_start = current->mm->start_stack -
 664                (MAX_ARG_PAGES * PAGE_SIZE - bprm->p);
 665#endif
 666
 667        p = (char __user *) current->mm->arg_start;
 668        for (loop = bprm->argc; loop > 0; loop--) {
 669                __put_user((elf_caddr_t) p, argv++);
 670                len = strnlen_user(p, MAX_ARG_STRLEN);
 671                if (!len || len > MAX_ARG_STRLEN)
 672                        return -EINVAL;
 673                p += len;
 674        }
 675        __put_user(NULL, argv);
 676        current->mm->arg_end = (unsigned long) p;
 677
 678        /* fill in the envv[] array */
 679        current->mm->env_start = (unsigned long) p;
 680        for (loop = bprm->envc; loop > 0; loop--) {
 681                __put_user((elf_caddr_t)(unsigned long) p, envp++);
 682                len = strnlen_user(p, MAX_ARG_STRLEN);
 683                if (!len || len > MAX_ARG_STRLEN)
 684                        return -EINVAL;
 685                p += len;
 686        }
 687        __put_user(NULL, envp);
 688        current->mm->env_end = (unsigned long) p;
 689
 690        mm->start_stack = (unsigned long) sp;
 691        return 0;
 692}
 693
 694/*****************************************************************************/
 695/*
 696 * transfer the program arguments and environment from the holding pages onto
 697 * the stack
 698 */
 699#ifndef CONFIG_MMU
 700static int elf_fdpic_transfer_args_to_stack(struct linux_binprm *bprm,
 701                                            unsigned long *_sp)
 702{
 703        unsigned long index, stop, sp;
 704        char *src;
 705        int ret = 0;
 706
 707        stop = bprm->p >> PAGE_SHIFT;
 708        sp = *_sp;
 709
 710        for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
 711                src = kmap(bprm->page[index]);
 712                sp -= PAGE_SIZE;
 713                if (copy_to_user((void *) sp, src, PAGE_SIZE) != 0)
 714                        ret = -EFAULT;
 715                kunmap(bprm->page[index]);
 716                if (ret < 0)
 717                        goto out;
 718        }
 719
 720        *_sp = (*_sp - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p)) & ~15;
 721
 722out:
 723        return ret;
 724}
 725#endif
 726
 727/*****************************************************************************/
 728/*
 729 * load the appropriate binary image (executable or interpreter) into memory
 730 * - we assume no MMU is available
 731 * - if no other PIC bits are set in params->hdr->e_flags
 732 *   - we assume that the LOADable segments in the binary are independently relocatable
 733 *   - we assume R/O executable segments are shareable
 734 * - else
 735 *   - we assume the loadable parts of the image to require fixed displacement
 736 *   - the image is not shareable
 737 */
 738static int elf_fdpic_map_file(struct elf_fdpic_params *params,
 739                              struct file *file,
 740                              struct mm_struct *mm,
 741                              const char *what)
 742{
 743        struct elf32_fdpic_loadmap *loadmap;
 744#ifdef CONFIG_MMU
 745        struct elf32_fdpic_loadseg *mseg;
 746#endif
 747        struct elf32_fdpic_loadseg *seg;
 748        struct elf32_phdr *phdr;
 749        unsigned long load_addr, stop;
 750        unsigned nloads, tmp;
 751        size_t size;
 752        int loop, ret;
 753
 754        /* allocate a load map table */
 755        nloads = 0;
 756        for (loop = 0; loop < params->hdr.e_phnum; loop++)
 757                if (params->phdrs[loop].p_type == PT_LOAD)
 758                        nloads++;
 759
 760        if (nloads == 0)
 761                return -ELIBBAD;
 762
 763        size = sizeof(*loadmap) + nloads * sizeof(*seg);
 764        loadmap = kzalloc(size, GFP_KERNEL);
 765        if (!loadmap)
 766                return -ENOMEM;
 767
 768        params->loadmap = loadmap;
 769
 770        loadmap->version = ELF32_FDPIC_LOADMAP_VERSION;
 771        loadmap->nsegs = nloads;
 772
 773        load_addr = params->load_addr;
 774        seg = loadmap->segs;
 775
 776        /* map the requested LOADs into the memory space */
 777        switch (params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) {
 778        case ELF_FDPIC_FLAG_CONSTDISP:
 779        case ELF_FDPIC_FLAG_CONTIGUOUS:
 780#ifndef CONFIG_MMU
 781                ret = elf_fdpic_map_file_constdisp_on_uclinux(params, file, mm);
 782                if (ret < 0)
 783                        return ret;
 784                break;
 785#endif
 786        default:
 787                ret = elf_fdpic_map_file_by_direct_mmap(params, file, mm);
 788                if (ret < 0)
 789                        return ret;
 790                break;
 791        }
 792
 793        /* map the entry point */
 794        if (params->hdr.e_entry) {
 795                seg = loadmap->segs;
 796                for (loop = loadmap->nsegs; loop > 0; loop--, seg++) {
 797                        if (params->hdr.e_entry >= seg->p_vaddr &&
 798                            params->hdr.e_entry < seg->p_vaddr + seg->p_memsz) {
 799                                params->entry_addr =
 800                                        (params->hdr.e_entry - seg->p_vaddr) +
 801                                        seg->addr;
 802                                break;
 803                        }
 804                }
 805        }
 806
 807        /* determine where the program header table has wound up if mapped */
 808        stop = params->hdr.e_phoff;
 809        stop += params->hdr.e_phnum * sizeof (struct elf_phdr);
 810        phdr = params->phdrs;
 811
 812        for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
 813                if (phdr->p_type != PT_LOAD)
 814                        continue;
 815
 816                if (phdr->p_offset > params->hdr.e_phoff ||
 817                    phdr->p_offset + phdr->p_filesz < stop)
 818                        continue;
 819
 820                seg = loadmap->segs;
 821                for (loop = loadmap->nsegs; loop > 0; loop--, seg++) {
 822                        if (phdr->p_vaddr >= seg->p_vaddr &&
 823                            phdr->p_vaddr + phdr->p_filesz <=
 824                            seg->p_vaddr + seg->p_memsz) {
 825                                params->ph_addr =
 826                                        (phdr->p_vaddr - seg->p_vaddr) +
 827                                        seg->addr +
 828                                        params->hdr.e_phoff - phdr->p_offset;
 829                                break;
 830                        }
 831                }
 832                break;
 833        }
 834
 835        /* determine where the dynamic section has wound up if there is one */
 836        phdr = params->phdrs;
 837        for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
 838                if (phdr->p_type != PT_DYNAMIC)
 839                        continue;
 840
 841                seg = loadmap->segs;
 842                for (loop = loadmap->nsegs; loop > 0; loop--, seg++) {
 843                        if (phdr->p_vaddr >= seg->p_vaddr &&
 844                            phdr->p_vaddr + phdr->p_memsz <=
 845                            seg->p_vaddr + seg->p_memsz) {
 846                                params->dynamic_addr =
 847                                        (phdr->p_vaddr - seg->p_vaddr) +
 848                                        seg->addr;
 849
 850                                /* check the dynamic section contains at least
 851                                 * one item, and that the last item is a NULL
 852                                 * entry */
 853                                if (phdr->p_memsz == 0 ||
 854                                    phdr->p_memsz % sizeof(Elf32_Dyn) != 0)
 855                                        goto dynamic_error;
 856
 857                                tmp = phdr->p_memsz / sizeof(Elf32_Dyn);
 858                                if (((Elf32_Dyn *)
 859                                     params->dynamic_addr)[tmp - 1].d_tag != 0)
 860                                        goto dynamic_error;
 861                                break;
 862                        }
 863                }
 864                break;
 865        }
 866
 867        /* now elide adjacent segments in the load map on MMU linux
 868         * - on uClinux the holes between may actually be filled with system
 869         *   stuff or stuff from other processes
 870         */
 871#ifdef CONFIG_MMU
 872        nloads = loadmap->nsegs;
 873        mseg = loadmap->segs;
 874        seg = mseg + 1;
 875        for (loop = 1; loop < nloads; loop++) {
 876                /* see if we have a candidate for merging */
 877                if (seg->p_vaddr - mseg->p_vaddr == seg->addr - mseg->addr) {
 878                        load_addr = PAGE_ALIGN(mseg->addr + mseg->p_memsz);
 879                        if (load_addr == (seg->addr & PAGE_MASK)) {
 880                                mseg->p_memsz +=
 881                                        load_addr -
 882                                        (mseg->addr + mseg->p_memsz);
 883                                mseg->p_memsz += seg->addr & ~PAGE_MASK;
 884                                mseg->p_memsz += seg->p_memsz;
 885                                loadmap->nsegs--;
 886                                continue;
 887                        }
 888                }
 889
 890                mseg++;
 891                if (mseg != seg)
 892                        *mseg = *seg;
 893        }
 894#endif
 895
 896        kdebug("Mapped Object [%s]:", what);
 897        kdebug("- elfhdr   : %lx", params->elfhdr_addr);
 898        kdebug("- entry    : %lx", params->entry_addr);
 899        kdebug("- PHDR[]   : %lx", params->ph_addr);
 900        kdebug("- DYNAMIC[]: %lx", params->dynamic_addr);
 901        seg = loadmap->segs;
 902        for (loop = 0; loop < loadmap->nsegs; loop++, seg++)
 903                kdebug("- LOAD[%d] : %08x-%08x [va=%x ms=%x]",
 904                       loop,
 905                       seg->addr, seg->addr + seg->p_memsz - 1,
 906                       seg->p_vaddr, seg->p_memsz);
 907
 908        return 0;
 909
 910dynamic_error:
 911        printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
 912               what, file->f_path.dentry->d_inode->i_ino);
 913        return -ELIBBAD;
 914}
 915
 916/*****************************************************************************/
 917/*
 918 * map a file with constant displacement under uClinux
 919 */
 920#ifndef CONFIG_MMU
 921static int elf_fdpic_map_file_constdisp_on_uclinux(
 922        struct elf_fdpic_params *params,
 923        struct file *file,
 924        struct mm_struct *mm)
 925{
 926        struct elf32_fdpic_loadseg *seg;
 927        struct elf32_phdr *phdr;
 928        unsigned long load_addr, base = ULONG_MAX, top = 0, maddr = 0, mflags;
 929        loff_t fpos;
 930        int loop, ret;
 931
 932        load_addr = params->load_addr;
 933        seg = params->loadmap->segs;
 934
 935        /* determine the bounds of the contiguous overall allocation we must
 936         * make */
 937        phdr = params->phdrs;
 938        for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
 939                if (params->phdrs[loop].p_type != PT_LOAD)
 940                        continue;
 941
 942                if (base > phdr->p_vaddr)
 943                        base = phdr->p_vaddr;
 944                if (top < phdr->p_vaddr + phdr->p_memsz)
 945                        top = phdr->p_vaddr + phdr->p_memsz;
 946        }
 947
 948        /* allocate one big anon block for everything */
 949        mflags = MAP_PRIVATE;
 950        if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE)
 951                mflags |= MAP_EXECUTABLE;
 952
 953        maddr = vm_mmap(NULL, load_addr, top - base,
 954                        PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0);
 955        if (IS_ERR_VALUE(maddr))
 956                return (int) maddr;
 957
 958        if (load_addr != 0)
 959                load_addr += PAGE_ALIGN(top - base);
 960
 961        /* and then load the file segments into it */
 962        phdr = params->phdrs;
 963        for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
 964                if (params->phdrs[loop].p_type != PT_LOAD)
 965                        continue;
 966
 967                fpos = phdr->p_offset;
 968
 969                seg->addr = maddr + (phdr->p_vaddr - base);
 970                seg->p_vaddr = phdr->p_vaddr;
 971                seg->p_memsz = phdr->p_memsz;
 972
 973                ret = file->f_op->read(file, (void *) seg->addr,
 974                                       phdr->p_filesz, &fpos);
 975                if (ret < 0)
 976                        return ret;
 977
 978                /* map the ELF header address if in this segment */
 979                if (phdr->p_offset == 0)
 980                        params->elfhdr_addr = seg->addr;
 981
 982                /* clear any space allocated but not loaded */
 983                if (phdr->p_filesz < phdr->p_memsz) {
 984                        if (clear_user((void *) (seg->addr + phdr->p_filesz),
 985                                       phdr->p_memsz - phdr->p_filesz))
 986                                return -EFAULT;
 987                }
 988
 989                if (mm) {
 990                        if (phdr->p_flags & PF_X) {
 991                                if (!mm->start_code) {
 992                                        mm->start_code = seg->addr;
 993                                        mm->end_code = seg->addr +
 994                                                phdr->p_memsz;
 995                                }
 996                        } else if (!mm->start_data) {
 997                                mm->start_data = seg->addr;
 998                                mm->end_data = seg->addr + phdr->p_memsz;
 999                        }
1000                }
1001
1002                seg++;
1003        }
1004
1005        return 0;
1006}
1007#endif
1008
1009/*****************************************************************************/
1010/*
1011 * map a binary by direct mmap() of the individual PT_LOAD segments
1012 */
1013static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1014                                             struct file *file,
1015                                             struct mm_struct *mm)
1016{
1017        struct elf32_fdpic_loadseg *seg;
1018        struct elf32_phdr *phdr;
1019        unsigned long load_addr, delta_vaddr;
1020        int loop, dvset;
1021
1022        load_addr = params->load_addr;
1023        delta_vaddr = 0;
1024        dvset = 0;
1025
1026        seg = params->loadmap->segs;
1027
1028        /* deal with each load segment separately */
1029        phdr = params->phdrs;
1030        for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
1031                unsigned long maddr, disp, excess, excess1;
1032                int prot = 0, flags;
1033
1034                if (phdr->p_type != PT_LOAD)
1035                        continue;
1036
1037                kdebug("[LOAD] va=%lx of=%lx fs=%lx ms=%lx",
1038                       (unsigned long) phdr->p_vaddr,
1039                       (unsigned long) phdr->p_offset,
1040                       (unsigned long) phdr->p_filesz,
1041                       (unsigned long) phdr->p_memsz);
1042
1043                /* determine the mapping parameters */
1044                if (phdr->p_flags & PF_R) prot |= PROT_READ;
1045                if (phdr->p_flags & PF_W) prot |= PROT_WRITE;
1046                if (phdr->p_flags & PF_X) prot |= PROT_EXEC;
1047
1048                flags = MAP_PRIVATE | MAP_DENYWRITE;
1049                if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE)
1050                        flags |= MAP_EXECUTABLE;
1051
1052                maddr = 0;
1053
1054                switch (params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) {
1055                case ELF_FDPIC_FLAG_INDEPENDENT:
1056                        /* PT_LOADs are independently locatable */
1057                        break;
1058
1059                case ELF_FDPIC_FLAG_HONOURVADDR:
1060                        /* the specified virtual address must be honoured */
1061                        maddr = phdr->p_vaddr;
1062                        flags |= MAP_FIXED;
1063                        break;
1064
1065                case ELF_FDPIC_FLAG_CONSTDISP:
1066                        /* constant displacement
1067                         * - can be mapped anywhere, but must be mapped as a
1068                         *   unit
1069                         */
1070                        if (!dvset) {
1071                                maddr = load_addr;
1072                                delta_vaddr = phdr->p_vaddr;
1073                                dvset = 1;
1074                        } else {
1075                                maddr = load_addr + phdr->p_vaddr - delta_vaddr;
1076                                flags |= MAP_FIXED;
1077                        }
1078                        break;
1079
1080                case ELF_FDPIC_FLAG_CONTIGUOUS:
1081                        /* contiguity handled later */
1082                        break;
1083
1084                default:
1085                        BUG();
1086                }
1087
1088                maddr &= PAGE_MASK;
1089
1090                /* create the mapping */
1091                disp = phdr->p_vaddr & ~PAGE_MASK;
1092                maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags,
1093                                phdr->p_offset - disp);
1094
1095                kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx",
1096                       loop, phdr->p_memsz + disp, prot, flags,
1097                       phdr->p_offset - disp, maddr);
1098
1099                if (IS_ERR_VALUE(maddr))
1100                        return (int) maddr;
1101
1102                if ((params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) ==
1103                    ELF_FDPIC_FLAG_CONTIGUOUS)
1104                        load_addr += PAGE_ALIGN(phdr->p_memsz + disp);
1105
1106                seg->addr = maddr + disp;
1107                seg->p_vaddr = phdr->p_vaddr;
1108                seg->p_memsz = phdr->p_memsz;
1109
1110                /* map the ELF header address if in this segment */
1111                if (phdr->p_offset == 0)
1112                        params->elfhdr_addr = seg->addr;
1113
1114                /* clear the bit between beginning of mapping and beginning of
1115                 * PT_LOAD */
1116                if (prot & PROT_WRITE && disp > 0) {
1117                        kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp);
1118                        if (clear_user((void __user *) maddr, disp))
1119                                return -EFAULT;
1120                        maddr += disp;
1121                }
1122
1123                /* clear any space allocated but not loaded
1124                 * - on uClinux we can just clear the lot
1125                 * - on MMU linux we'll get a SIGBUS beyond the last page
1126                 *   extant in the file
1127                 */
1128                excess = phdr->p_memsz - phdr->p_filesz;
1129                excess1 = PAGE_SIZE - ((maddr + phdr->p_filesz) & ~PAGE_MASK);
1130
1131#ifdef CONFIG_MMU
1132                if (excess > excess1) {
1133                        unsigned long xaddr = maddr + phdr->p_filesz + excess1;
1134                        unsigned long xmaddr;
1135
1136                        flags |= MAP_FIXED | MAP_ANONYMOUS;
1137                        xmaddr = vm_mmap(NULL, xaddr, excess - excess1,
1138                                         prot, flags, 0);
1139
1140                        kdebug("mmap[%d] <anon>"
1141                               " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx",
1142                               loop, xaddr, excess - excess1, prot, flags,
1143                               xmaddr);
1144
1145                        if (xmaddr != xaddr)
1146                                return -ENOMEM;
1147                }
1148
1149                if (prot & PROT_WRITE && excess1 > 0) {
1150                        kdebug("clear[%d] ad=%lx sz=%lx",
1151                               loop, maddr + phdr->p_filesz, excess1);
1152                        if (clear_user((void __user *) maddr + phdr->p_filesz,
1153                                       excess1))
1154                                return -EFAULT;
1155                }
1156
1157#else
1158                if (excess > 0) {
1159                        kdebug("clear[%d] ad=%lx sz=%lx",
1160                               loop, maddr + phdr->p_filesz, excess);
1161                        if (clear_user((void *) maddr + phdr->p_filesz, excess))
1162                                return -EFAULT;
1163                }
1164#endif
1165
1166                if (mm) {
1167                        if (phdr->p_flags & PF_X) {
1168                                if (!mm->start_code) {
1169                                        mm->start_code = maddr;
1170                                        mm->end_code = maddr + phdr->p_memsz;
1171                                }
1172                        } else if (!mm->start_data) {
1173                                mm->start_data = maddr;
1174                                mm->end_data = maddr + phdr->p_memsz;
1175                        }
1176                }
1177
1178                seg++;
1179        }
1180
1181        return 0;
1182}
1183
1184/*****************************************************************************/
1185/*
1186 * ELF-FDPIC core dumper
1187 *
1188 * Modelled on fs/exec.c:aout_core_dump()
1189 * Jeremy Fitzhardinge <jeremy@sw.oz.au>
1190 *
1191 * Modelled on fs/binfmt_elf.c core dumper
1192 */
1193#ifdef CONFIG_ELF_CORE
1194
1195/*
1196 * Decide whether a segment is worth dumping; default is yes to be
1197 * sure (missing info is worse than too much; etc).
1198 * Personally I'd include everything, and use the coredump limit...
1199 *
1200 * I think we should skip something. But I am not sure how. H.J.
1201 */
1202static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
1203{
1204        int dump_ok;
1205
1206        /* Do not dump I/O mapped devices or special mappings */
1207        if (vma->vm_flags & VM_IO) {
1208                kdcore("%08lx: %08lx: no (IO)", vma->vm_start, vma->vm_flags);
1209                return 0;
1210        }
1211
1212        /* If we may not read the contents, don't allow us to dump
1213         * them either. "dump_write()" can't handle it anyway.
1214         */
1215        if (!(vma->vm_flags & VM_READ)) {
1216                kdcore("%08lx: %08lx: no (!read)", vma->vm_start, vma->vm_flags);
1217                return 0;
1218        }
1219
1220        /* By default, dump shared memory if mapped from an anonymous file. */
1221        if (vma->vm_flags & VM_SHARED) {
1222                if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) {
1223                        dump_ok = test_bit(MMF_DUMP_ANON_SHARED, &mm_flags);
1224                        kdcore("%08lx: %08lx: %s (share)", vma->vm_start,
1225                               vma->vm_flags, dump_ok ? "yes" : "no");
1226                        return dump_ok;
1227                }
1228
1229                dump_ok = test_bit(MMF_DUMP_MAPPED_SHARED, &mm_flags);
1230                kdcore("%08lx: %08lx: %s (share)", vma->vm_start,
1231                       vma->vm_flags, dump_ok ? "yes" : "no");
1232                return dump_ok;
1233        }
1234
1235#ifdef CONFIG_MMU
1236        /* By default, if it hasn't been written to, don't write it out */
1237        if (!vma->anon_vma) {
1238                dump_ok = test_bit(MMF_DUMP_MAPPED_PRIVATE, &mm_flags);
1239                kdcore("%08lx: %08lx: %s (!anon)", vma->vm_start,
1240                       vma->vm_flags, dump_ok ? "yes" : "no");
1241                return dump_ok;
1242        }
1243#endif
1244
1245        dump_ok = test_bit(MMF_DUMP_ANON_PRIVATE, &mm_flags);
1246        kdcore("%08lx: %08lx: %s", vma->vm_start, vma->vm_flags,
1247               dump_ok ? "yes" : "no");
1248        return dump_ok;
1249}
1250
1251/* An ELF note in memory */
1252struct memelfnote
1253{
1254        const char *name;
1255        int type;
1256        unsigned int datasz;
1257        void *data;
1258};
1259
1260static int notesize(struct memelfnote *en)
1261{
1262        int sz;
1263
1264        sz = sizeof(struct elf_note);
1265        sz += roundup(strlen(en->name) + 1, 4);
1266        sz += roundup(en->datasz, 4);
1267
1268        return sz;
1269}
1270
1271/* #define DEBUG */
1272
1273#define DUMP_WRITE(addr, nr, foffset)   \
1274        do { if (!dump_write(file, (addr), (nr))) return 0; *foffset += (nr); } while(0)
1275
1276static int alignfile(struct file *file, loff_t *foffset)
1277{
1278        static const char buf[4] = { 0, };
1279        DUMP_WRITE(buf, roundup(*foffset, 4) - *foffset, foffset);
1280        return 1;
1281}
1282
1283static int writenote(struct memelfnote *men, struct file *file,
1284                        loff_t *foffset)
1285{
1286        struct elf_note en;
1287        en.n_namesz = strlen(men->name) + 1;
1288        en.n_descsz = men->datasz;
1289        en.n_type = men->type;
1290
1291        DUMP_WRITE(&en, sizeof(en), foffset);
1292        DUMP_WRITE(men->name, en.n_namesz, foffset);
1293        if (!alignfile(file, foffset))
1294                return 0;
1295        DUMP_WRITE(men->data, men->datasz, foffset);
1296        if (!alignfile(file, foffset))
1297                return 0;
1298
1299        return 1;
1300}
1301#undef DUMP_WRITE
1302
1303static inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs)
1304{
1305        memcpy(elf->e_ident, ELFMAG, SELFMAG);
1306        elf->e_ident[EI_CLASS] = ELF_CLASS;
1307        elf->e_ident[EI_DATA] = ELF_DATA;
1308        elf->e_ident[EI_VERSION] = EV_CURRENT;
1309        elf->e_ident[EI_OSABI] = ELF_OSABI;
1310        memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD);
1311
1312        elf->e_type = ET_CORE;
1313        elf->e_machine = ELF_ARCH;
1314        elf->e_version = EV_CURRENT;
1315        elf->e_entry = 0;
1316        elf->e_phoff = sizeof(struct elfhdr);
1317        elf->e_shoff = 0;
1318        elf->e_flags = ELF_FDPIC_CORE_EFLAGS;
1319        elf->e_ehsize = sizeof(struct elfhdr);
1320        elf->e_phentsize = sizeof(struct elf_phdr);
1321        elf->e_phnum = segs;
1322        elf->e_shentsize = 0;
1323        elf->e_shnum = 0;
1324        elf->e_shstrndx = 0;
1325        return;
1326}
1327
1328static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset)
1329{
1330        phdr->p_type = PT_NOTE;
1331        phdr->p_offset = offset;
1332        phdr->p_vaddr = 0;
1333        phdr->p_paddr = 0;
1334        phdr->p_filesz = sz;
1335        CON33 = 0;
1167                        if (1167    " cla               if" clahref="+code=u    if (!mm_33">sz;
vm34type;
"3o&quo3;
inline void static int writic int n_type =t d3mp_ok;
elf_phdr *href="fs/binfmt_elf_fdpic.c#L1257" id="L1257" clef="+code=loff_t" class="sref">loff_d="L1242" 3lass="line" name="L1242">3242
12434 = 0;
DUMP_WRITE+code=phdr" class=#L1254" id="L1254" class="line" name="L1254">1254        c3#L1244" id3"L1244" class="line" name3"L1243">1244
n_type =ass="line" name="L1 class="sref">n_type = m3;mm_3lags);
data, phdr->pt;vm34hdr);
1257   3/span> : <3pan class="string">"3o&quo3;);
1257   3/ d3mp_ok;
1249}
1250
123an class="3omment">/* An ELF note in3memor35er
    220"" clgiv"L12ask href=", except" id="L1271" class="line" name="L1271">123a="L1242" 3de=memelfnote" class="sre3">mem35mp
    lfs/up2separatelass="comment">         * them either. "3L1253" id=3L1253" class="line" name=3L125335y.
123nst char *3a href="+code=name" class3"sref3>name<
  286" id="L1286"1328"pr  sref">inline void fill_elf_nr  286" id="L1286"+r  lasst type;
inline void fill_elf_n286" id="L1286"+ *ct" class="sref">vm_ef=""L1167" class="lef=""" clef="+code=loff_t" class="sref">loff_d int 35fset)
 = 0;
  lasse="L1167">1167   r_s/bo286" id="L1286"+r_s/bolass>->  286" id="L1286"+r  lasse="L1167">1167   r_curef=286" id="L1286"+r_curef= 1257   31258" id="31258" class="line" name="31258"35LAGS;
  lasse="L1167">1167   r_ef=pend286" id="L1286"+r_ef=pend" cl+code=phdr" class=n286" id="L1286"+e="L1167">1167     }
n=286" id="L1286"+  }
n=lass>->->1257   3#L1259" id3"L1259" class="line" name3"L125361329{
  lasse="L1167">1167   r_ef=hold286" id="L1286"+r_ef=hold" cl+code=phdr" class=n286" id="L1286"+e="L1167">1167  blocked286" id="L1286"blockedlass>->1257   3#L1250" id3> *e_phentsize = sizeof(structL1261" id=3L1261" class="line" name=3L126136fset;
  lasse="L1167">1167   r_ppid286" id="L1286"+r_ppida> =ass="line" name="L1asktpid_v""L1167" class="l1asktpid_v""sref"href="fs/binfmtrcu_de="fe="ncint e="L1167">1167  e=k8"parclass="sref">memsee=k8"parcla" clesref">e_phentsize = sizeof(structL="L1242" 3nt e_phentsize = sizeof(structL1253" id=3"L1263" class="line" name3"L1263">1263
  lasse="L1167">1167   r_pid286" id="L1286"+r_pida> =ass="line" name="L1asktpid_v""L1167" class="l1asktpid_v""sref"href="fs/binfmtn286" id="L1286"+sref">e_phentsize = sizeof(structLst char *3code=elf_note" class="sre3">elf3note);
  lasse="L1167">1167   r_pgrn286" id="L1286"+r_pgrna> =ass="line" name="L1asktpgrn_v""L1167" class="l1asktpgrn_v""sref"href="fs/binfmtn286" id="L1286"+sref">e_phentsize = sizeof(structL     int 3code=name" class="sref">n3me  lasse="L1167">1167   r_efd286" id="L1286"+r_efda> =ass="line" name="L1asktsesa hr_v""L1167" class="l1asktsesa hr_v""sref"href="fs/binfmtn286" id="L1286"+sref">e_phentsize = sizeof(structL int s="+code=vma" class="sref">vma->3#L1267" id3"L1267" class="line" name3"L12636ma) {
e_phentsize = sizeof(structL258" id="3rn );
123#L1270" id3"L1270" class="line" name3"L1273">1270
123#1261" id=3class="comment">/* #defin3 DEBU37er
         * them either. "3#L1272" id3"L1272" class="line" name3"L12737mp
123)   \
est_bit(e_phentsize = sizeof(struct (nr3/a>);37tart,
->(  lasse="L1167">1167   r_uti1254" id="L1254"  r_uti12, insref">e_phentsize = sizeof(struct      int 3"L1275" class="line" name3"L12737D)) {
->(  lasse="L1167">1167   r_sti1254" id="L1254"  r_sti12, insref">e_phentsize = sizeof(struct  int f37*/
vma->3L1277" id=3L1277" class="line" name=3L127737ma) {
e="L1167">1167  uti1254" id="L1254" uti12, inest_bit(  lasse="L1167">1167   r_uti1254" id="L1254"  r_uti12, insref">e_phentsize = sizeof(struct 258" id="3ode=buf" class="sref">buf3/a>[437ags);
e="L1167">1167  sti1254" id="L1254" sti12, inest_bit(  lasse="L1167">1167   r_sti1254" id="L1254"  r_sti12, insref">e_phentsize = sizeof(struct>, fo3fset);
;
12803     38NOTE;
e="L1167">1167  signalL1167" class="lef="allasse="L1167">1167  cuti1254" id="L1254" cuti12, inest_bit(  lasse="L1167">1167   r_cuti1254" id="L1254"  r_cuti12, insref">e_phentsize = sizeof(struct>1261" id=3L1281" class="line" name=3L128138fset;
e="L1167">1167  signalL1167" class="lef="allasse="L1167">1167  csti1254" id="L1254" csti12, inest_bit(  lasse="L1167">1167   r_csti1254" id="L1254"  r_csti12, insref">e_phentsize = sizeof(struct>L1272" id3"L1282" class="line" name3"L12838">sz;
1263
  lasse="L1167">1167   r_execclass="loadman286" id="L1286"+r_execclass="loadman" cl+code=phdr" class=n286" id="L1286"+e="L1167">1167  m1323">1323  mmlasse="L1167">1167  contexass="sref">memsecontexa, in>->e_phentsize = sizeof(struct>(f38ote);
  lasse="L1167">1167   r_interpclass="loadman286" id="L1286"+r_interpclass="loadman" cl+code=phdr" class=n286" id="L1286"+e="L1167">1167  m1323">1323  mmlasse="L1167">1167  contexass="sref">memsecontexa, in>->e_phentsize = sizeof(struct>     int 3L1285" class="line" name=3L128538  return;
nam38>1327
inline void fill_elf_nss/bo286" id="L1286"pss/bolass"+code=memelfnote" class2asktatic int fill_elf_n286" id="L1286"+ /a>}
38ags);
fill_elf_m1323">1323  mmlassef="+code=loff_t" class="sref">loff_n->3a href="+code=type" class3"sref3>type<+code=vma" class="sref">vma->3#L1290" id3"L1290" class="line" name3"L1293">1290
fill_elf_cred286" id="L1286"credlassref">e_phentsize = sizeof(struct), fo3fset);
en.fo39">sz;
fo3fset))

ce *1" id="L1271" class="line" name="L1271">123"line" nam3="L1294">1294        3     3 return 0;
elf->e_phentsize = sizeof(struct>, fo3fsete_phentsize = sizeof(struct>elf_note<3"+code=foffset" class="sr3f">fo39hdr);
en.1323  mmlasse="L1167">1167  arg_end286" id="L1286"arg_endct < - 1323  mmlasse="L1167">1167  arg_lx: %s"1297        3     39ma) {
en.en.loff_n258" id="3"L1298" class="line" name3"L12939ags);
en.en.12994     400a) {
memsecopy_ 220_user10" ct_bit(1167   r_psarg 286" id="L1286"+r_psarg  /a>}
);
memse__user10"  *) 1323  mmlasse="L1167">1167  arg_lx: %s"en.fileDUM40p_ok;
 = 0;
en.file)   \
1167   r_psarg 286" id="L1286"+r_psarg ef="+code=elf" ci286" id="L1286"ilass] ="+cef="+code=file" class="sref">file1294        4L130440tart,
1167   r_psarg 286" id="L1286"+r_psarg ef="+code=elf" ci286" id="L1286"ilass] ="+code=dump_ok" class="#39; "#39;" id="La href="+code=elf_note" class="sref4#61302" id4"+code=foffset" class="sr4f">SE4FMAG);
1167   r_psarg 286" id="L1286"+r_psarg ef="+code=elf" css="sref">en.ELF401326}
EL4_DATA;
e_phentsize = sizeof(struc4 href="+co4e=EV_CURRENT" class="sref4>EV_C4RRENT;
1167   r_ppid286" id="L1286"+r_ppida> =ass="line" name="L1asktpid_v""L1167" class="l1asktpid_v""sref"href="fs/binfmtrcu_de="fe="ncint e="L1167">1167  e=k8"parclass="sref">memsee=k8"parcla" clesref">e_phentsize = sizeof(struc4ELF4OSABI;
e_phentsize = sizeof(struc4-E41NOTE;
1167   r_pid286" id="L1286"+r_pida> =ass="line" name="L1asktpid_v""L1167" class="l1asktpid_v""sref"href="fs/binfmtn286" id="L1286"+sref">e_phentsize = sizeof(struc4#L1311" id4"L1311" class="line" name4"L1314">1311
1167   r_pgrn286" id="L1286"+r_pgrna> =ass="line" name="L1asktpgrn_v""L1167" class="l1asktpgrn_v""sref"href="fs/binfmtn286" id="L1286"+sref">e_phentsize = sizeof(struc4> = E4_CORE;
1167   r_efd286" id="L1286"+r_efda> =ass="line" name="L1asktsesa hr_v""L1167" class="l1asktsesa hr_v""sref"href="fs/binfmtn286" id="L1286"+sref">e_phentsize = sizeof(struc4= EL4_ARCHe_phentsize = sizeof(struc4=51302" id4e=EV_CURRENT" class="sref4>EV_C4RRENT;
e="L1167">1167  sta int phdr-&1fssref"~href="fs/binfmtn286" id="L1286"+e="L1167">1167  sta int  = 0;
1167   r_eta int e4fhdr);
1167   r_e#L1254" id="L1254"  r_e#L12lass="+f="fs/binfmt_elfi286" id="L1286"ilass=="L1 5)=?fmcode=dump_ok" class="#39;."#39;" id="L :+mcode=dump_ok" class="quot;RSDTZW"quot;" id="Lef="+code=elf" ci286" id="L1286"ilass]ode=u    if (! = 0;
1167   r_zomb54" id="L1254"  r_zomblass="+href="fs/binfmtnss/bo286" id="L1286"pss/bolasse="L1167">1167   r_e#L1254" id="L1254"  r_e#L12lass="="+code=dump_ok" class="#39;Z"#39;" id="La href="+code=elf_note" class="sref4_CORE_EFLA4S" class="sref">ELF_FDPIC4CORE_4FLAGS;
1167   r_nicint sref">e_phentsize = sizeof(struc4ruct e4fhdr);
1167   r_ (e="L1167">1167                       (e_phentsize = sizeof(struc4r/a>-elf4phdr);
e_phentsize = sizeof(struc4num = 4a href="+code=segs" class4"sref4>segs;
sref">e_phentsize = sizeof(struc4r = e_s4entsi4e = 0;
1167   r_ufd286" id="L1286"+r_ufda> =="+code=alignfile"220_kufd_munged286" id="L1286""220_kufd_munged10" class="line" namcred286" id="L1286"credlasse="L1167">1167  user_n                user_n a> =="+code=alignfilecred286" id="L1286"credlasse="L1167">1167  ufd286" id="L1286"ufda> =esref">e_phentsize = sizeof(struc4 = 0;
1167   r_gfd286" id="L1286"+r_gfda> =="+code=alignfile"220_kgfd_munged286" id="L1286""220_kgfd_munged10" class="line" namcred286" id="L1286"credlasse="L1167">1167  user_n                user_n a> =="+code=alignfilecred286" id="L1286"credlasse="L1167">1167  gfd286" id="L1286"gfda> =esref">e_phentsize = sizeof(struc4<51302" id4shstrndx" class="sref">e_4hstrn42RENT;
e_phentsize = sizeof(struc425" class=4line" name="L1325">1325    42 = 0;
1167   r_f#L1254" id="L1254"  r_fclass="lf=href="fs/binfmtn286" id="L1286"+e="L1167">1167  "fs/ss="sref">memsecommlasscode=DUMP_WRITE" class="nss/bo286" id="L1286"pss/bolasse="L1167">1167   r_f#L1254" id="L1254"  r_fclass="lesref">e_phentsize = sizeof(struc41326}
);
 42p_ok;
}
P43>1250
   of each " L1212is caprured. *1" id="L1271" class="line" name="L1271">124/a> = 4ffsetelf->  286" id="L1286"ef="2he=kd_  249}

 = 0;
elf->list"sref"sref">en. =f">elf->list"sref">en.e_phentsize = sizeof(struc4_fileszsz;
inline void 1167   r  286" id="L1286"+r  lass; a 
124/5" class=4 cl0ONFIG_MMU" class="sre4">CON43 = 0;
phame="pregset" lass=167">1167  fpu286" id="L1286""pulass; a           
124/a href="+4itten to, don't write4it ou43hdr);
fill_elf_2he=kdnt e_phentsize = sizeof(struc4_L1327" id4ode=anon_vma" class="sref4>anon43>1267#if}
[ mm_43LAGS;
phame="pxregset" lass=167">1167  xfpu286" id="L1286"x"pulass; a         
124t;vm44type<#  }
f1271" class="line" name="L1271">124t = "4o&quo441dr);
static int e3]ode=u    if (!d4mp_ok;
e_phentsize = sizeof(struc4d="L1242" 4lass="line" name="L1242">4242e_phentsize = sizeof(struc4da href="+4" class="line" name="L1244">12444ARCHe_phentsize = sizeof(struc4#L1244" id4"L1244" class="line" name4"L1244">1244//a>
124;mm_4lags
124;a href="+4+code=vm_flags" class="sr4f">vm44hdr
124/span> : <4pan class="string">"4o&quo4;
         * them either. "4/ d4mp_ok
124L1249" id=4L1249" class="line" name=4L12494>1249<
  286" id="L1286"ef="dumph2he=kd_  10" cct" class="sref">vm_ef=""L1167" class="lef=""" cl"+code=memelfnote" class  286" id="L1286"ef="2he=kd_  249<="sref">fill_elf_2nt 124L = 1250
/* An ELF note in4memor452dr);
fill_elf_n286" id="L1286"+ass="line" name="L1nt e_phentsize = sizeof(struc4a="L1242" 4de=memelfnote" class="sre4">mem453_ok;
phdr->e_phentsize = sizeof(struc4nst char *4a href="+code=name" class4"sref45RENT;
e_phentsize = sizeof(struc4d int 45hdr);
  286" id="L1286"1328"pr  sref"t_bit(  286" id="L1286"+r  lasst=href="fs/binfmtn286" id="L1286"+t=href="fs/binfmtef=""L1167" class="lef=""" cleode=u    if (! = 0;
_copy_2asktrs="sref">elf-&="+ccor>_copy_2asktrs="sref"href="fs/binfmtn286" id="L1286"+est_bit(  286" id="L1286"+r  lass>-> };
{
(e0],+mcode=dump_ok" class="quot;+las"quot;" id="Lt=href="fs/binfmtNT_PRSTATUS286" id="L1286"NT_PRSTATUSlasscode=DUMP_WRITE" class="1nt   286" id="L1286"+r  lass) /a>}
 *(  286" id="L1286"+r  lasseode=u    if (!;
phdr->1322      #eno 22"sref"t_bit(e0]eode=u    if (!e_phentsize = sizeof(struc4Lst char *4code=elf_note" class="sre4">elf4note);
  286" id="L1286"+r  lass>->ass="line" name="L="+ccor>_copy_2askt"pregssref">elf-&="+ccor>_copy_2askt"pregssref"href="fs/binfmtn286" id="L1286"+eshref="fs/binfmtNULL286" id="L1286"NULLest_bit(n4me  286" id="L1286"+r  lass>->="+code=vma" class="sref">vma->4L int (e1],+mcode=dump_ok" class="quot;+las"quot;" id="Lt=href="fs/binfmtNT_PRFPREG286" id="L1286"NT_PRFPREGlasscode=DUMP_WRITE" class="1nt }
) {
();
phdr->1322      #eno 22"sref"t_bit(e1]eode=u    if (!);
;
/* #defin4 DEBU47er;
[)   \
_copy_2asktx"pregssref">elf-&="+ccor>_copy_2asktx"pregssref"href="fs/binfmtn286" id="L1286"+est_bit(vma->4 (nr4/a>);47tart,
(e2],+mcode=dump_ok" class="quot;LINUX"quot;" id="Lt=href="fs/binfmtef="+lassXFPREG_TYPEident[vma->4 )) {
(f47*/
{
) {
phdr->1322      #eno 22"sref"t_bit(e2]eode=u    if (!buf4/a>[447ags);
;
fo48type<#  }
f1271" class="line" name="L1271">124" class="l4ne" name="L1280">12804     48NOTE;
phdr->;
sz;
1263
fill_elf_fill_elf_sd="4exttumref">phdr-&gd="4exttumecode=vma" class="sref">vma->4>(f48tart,
vaddr" class="sref">phame=addr" artelf-&segssrefe1271" class="line" name="L1271">124>     int 4L1285" class="line" name=4L128548  ret+code=vma" class="sref">vma->4>elf_note<4a> nam48 = 0;
1322      fhsdent 22"" classde=DUMP"sref">fill_elf_sd="4exttumref">phdr-&gd="4exttumeode=u    if (!48LAGS;
phdr-&fhsdtum" classs/binfmt_elf_fdpic.c#L1299" id="L1294n->4a href="+code=type" class4"sref491329{
phdr-&fhsda hrdx" class="line" name="LSHN_UNDEFref">phdr-&SHN_UNDEF" clode=u    if (!1290de=u    if (!fo49fset;
phdr-&gd="4exttume+0,elf" cla"sref">fill_elf_sd="4exttumref">phdr-&gd="4exttumeeode=u    if (!fo49">sz;
fo4fset))
fill_elf_sd="4exttumref">phdr-&gd="4exttume="L1167">1167  sh_typint 1294        4     4 return 0;
phdr-&gd="4exttume="L1167">1167  sh_ 22">1322      sh_ 22"ass="line" name="L="+L1167" class="lphdr-&fhsdtum" clode=u    if (!fo49 = 0;
phdr-&gd="4exttume="L1167">1167  sh_agsk>1322      sh_agskass="line" name="L="+L1167" class="lphdr-&fhsda hrdx" clode=u    if (!fo49hdr);
phdr-&gd="4exttume="L1167">1167  sh_s/bo286" id="L1286"sh_s/boass="line" name="L"egssref">elf-&segssrefode=u    if (!1297        4     49ma;
};
12995     500a
125L1300" id=5L1300" class="line" name=5L130050>1270

125L2300" id=5L+code=foffset" class="sr5">DUM50er
125#L1302" id5"L1302" class="line" name5"L13050mpelf-&CONFIG_MMU58};
1263
phame=lass="dumphseg/binssref"code=memelfnote" class   e286" id="L1286"132elass="sref">fill_elf_   e286" id="L1286"132elasst=href="fs/binfmtefze" class="sref">phefze" lass="sref">fill_elf_s22">1322      s22"ecode=vma" class="sref">vma->5a51302" id5""L1294">1294        5L130450tart,
fill_elf_limit"sref">en.125#61302" id5"+code=foffset" class="sr5f">SE50  ret+code=vma" class="sref">vma->5ELF50hdr);
fill_elf_vmant EL5_DATA;
ELF5OSABI;
memsecurrclae="L1167">1167  e1323">1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" classvmant 1167  vm_nexass="sref">memsevm_nexasrefe"+code=vma" class="sref">vma->5-E51);
memseaddrsrefode=u    if (!;
E5_CORE;
;
1167  maydump286" id="L1286"maydump10" class="line" namvmant 125= EL51)   \
)) {
memseaddrsrefass="line" name="Lvmant 1167  vm_lx: %s"memseaddrsrefa<ofmt_elf_fdpic.c#vmant 1167  vm_end286" id="L1286"vm_endsrefode=u    if (!e51*/
{
memseaddrsrefa+code=phdr" class=PAGE_SIZEident[vma->5< ) {
1322      pag"lass="sref">fill_elf_pag">1322      pag"lass=code=phdr" class=get"dumphpag">1322      get"dumphpag"10" class="line" namaddrss="sref">memseaddrsrefeode=u    if (!ELF_FDPIC5CORE_51ags);
1322      pag"lasse"+code=vma" class="sref">vma->5ruct e52ags);
fill_elf_kaddrss="sref">memsekaddrsrefass="line" name="Lkman286" id="L1286"kman" clf="fs/binfmt_elf_ag">1322      pag"lasseode=u    if (!elf52);
fill_elf_s22">1322      s22"a+code=phdr" class=PAGE_SIZEident[;
fill_elf_s22">1322      s22"a="L1 "sref">fill_elf_limit"sref">en.125r = e_s5entsi52CORE;
;
)   \
1167  dumphwriL1286" id="L1286"dumphwriL1" clf="fs/binfmt_elf   e286" id="L1286"132elasst=href="fs/binfmtkaddrss="sref">memsekaddrsreft=href="fs/binfmtPAGE_SIZEident[125r51302" id5shstrndx" class="sref">e_5hstrn52tart,
1325    52D)) {
1322      pag"lasseode=u    if (!
{
e_phentsizee_phentsize124/a> = e4fhdrnfmtame="pregset" class="sref">phame="preg    if (!fi}L1" clf="fs/binfmt_elf   e286" sees="lmemsekaddrsreft=href="fs/binfmtPAGE_SIZEidename="L1271">125r51302" id5shstrndx" class="sref">e_5hstrn52tart,
      pag"lasse"+code=vma" class="srIO286" id="L1286"rIOsrefode=u    if (!)   \
memsekaddrsrefa&="+ccor>_copy_2askt6"rIOsrefode=u    if (!e_5hstrn52tart,
      s22"a+code=phdr" clagotosrIO286" id="L12ou25r = )   \
  286" id5"L128532">1322      s22"s="line" name4"L12949258};
};
->list"sref"sref">5n5};
  286"5id="L5286"ef="+r)   \
ph53ref="+code=en" cla3s="sr381326}
12804     48NOTE;
512804     48NOTE;
p53e="L1271">124L1249" id=4L120" class="line" name=5L130050>1270
124t = <5 hre454="L1271">125L1300" id=5L130line" name="L1271">125L230 NO id=5L+code=foffset" class="sr5">DUM50er
static int };
1263
phame=lass="dumphseg/binssref"code=memelfnote" class   e286" id="L1286"132elass="sref">fill_elf_   e286" id="L1286"132elasst=href="fs/binfmtefze" class="sref">phefze" lass="sref">fill_elf_s22">1322      s22"ecode=vma" class="sref">vma->5a51302" id5""L1294">1294        5L130450tart,
 5 sizeof(struc4#L1244" id45L124454>  dumphwriL1286" id="L1286"dumpt=href="fs/ct" chref="fs/binfmt_m_                    _m_     srefe1271" class="line" name="L1271">125#61302" id5"+code=foffset" class="sr5f">SE50  ret+code=vma"ef="fs/bin5mt_" id="L1271" class="li5e" na5e="L12hdr" class="s5ef">e52ags);
fill_elf_vmant EL5_DATA;
);
      pae="Lcurrclass="sref">memsecurrclae="L1167">1167  e1323">1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" classvmant 1167  e1323"f">memsevm_nexasrefe"+code=vma" class="sref">vma->5-E51);
      pag"lasse"+co"line" namvmant 125= EL51)   \
5 286"55addrss="sref">memsekaddrsrefa_CURRENT" class="sref5>EV_C5RRENTfo49fset;
1322      s22""linll_elf_limit"sref">en.vma->5< 125r = e_s5entsi52CORE;
phdr->5)   \
 5 sizeof(struc4nst char *45 href5"+code=name" class4"sref45RENT;
memsekaddrsreft=href="fs/binf(" name arg_lx: %s&qquot;memseaddrsrefa<ofmt_elf_fd4        5L130450tart,
 5 sizeof(struc4d int 1322memseaddrsrefa<ofmt_elf_fdRCH" class="sr5f">EL51)   \
  286" id="L5286"155efeode=u              efref">f="+code=elf_note" class5r61302" id5line" name="L1325">1325    52D)) {
_copy_2asktrs="5ref">5lf-&="+cco+code=en" cla3s="sr381326}
{
42p_ok;
12804     48NOTE;
phdr->fo4fset))
 5 sizeof(struc4Lst char *45ode=e56="sref">phamelf_s22">1322      s22"ecode=vma" classss="dumphseg/binssreref_dataclass="l125#61302" id5"+code=foffset" class="sr5f">SE50  ret+code=vma"ef="fs/bin5mt1nt e52ags);
fill_elf_vmant EL5_DATA;
{
1167 >      s22"ecode=vma" classss="dumphseg/bi">en.(12804     48NOTE;
memsecurrclae="L1167">1167  e1323">1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" classvmant 1167  e1323"f">memsevm_nexasrefe"+code=vma" class="sref">vma->5-12804     48NOTE;
phdr5><5 =+code=phdr" class=#e&="+ccor>_copy_2askref="+covmasreft=href="fs/binfmt_m_                    _m_     srefee1271" class="line" name="L1271">125= EL51)   \
;
      s22"a+code=p_elf_limit"sref">en.memseaddrsrefa<ofmt_elf_fd" class="sref5>EV_C50258};
1322  ;
124;mm_4lags
mm_4lags
mm_4lags
phdr5><57" clfinal cor>    ess="commentThisa> =a two-p>  =5L+code; first    fian> :  offsetame=" :  bits=vm_flags" class="sr4f">vm44hdr
;
,5124L1249" id=4L1249span> : <4 : y e=u actually "fs/t <4out.  If    ru<4outme="a h4=size" c_flags" class="sr4f">vm44hdr
124" cla5s="l458="L1271">125L1300" id=5L130lin   just  ifncatode=dump_ok" class="s4ef">d4mp_ok
phdr-5gt;phame=lass="dumphseg/binssref"code="+covmasreft=href=nssref"code="+cf">fill_elf_   e286" id="L1e=u    ram1">125= e=u    ram1!12804     48NOTE;
 = 0;
1322 6class="sref"4p_pad4r = 0;
e=lass="dumphseg/bihase="+c286"gfda> =esref"hase="+c281" clENT" class="sref5>EV_C50258};
vma->4>elf_note<5a> e="L1167">11675+cass="sr    s22"ecode5+cass="sr  classss="dumphseg/bifa href="+co2s="l=">1297        4     49ma;
124>     int 4L1285" class7        4     49ma;
13 >      s22"ecode=vma" classss="dumphseg/bi">en..        4     49ma;
fill_elf_vmant EL5_DATA;
1167  e1323"f="+co2s="l="+code=DUMP_WRITA" class="sr5f">EL5_DATA;
ecodeloff  classss="dumphseg/bioffset  s22"ecodeoffset1" clENT class="line" namdatalignf4>span> : <4fdatalig271" class="line" namfoffset  s22"ecodefoffset1" cTA" class="sr5f">EL5_DATA;
EL5_DATA;
phdre="" cmelfnote" classteno 286" id="L1286"teno e3]ode=u    if  class1167  e1323"f="+co2s="l="+code=DUMP_WRITA" class="sr5f">EL5_DATA;
phdre="  lass=167">1167   r  286" id="L1286"+r  lass; a 
s=get"dumphpag">1d286" id="L1286"+r_fpvalfd="+c">1167  e1323"f="+co2s="l="+code=DUMP_WRIT ="line" name="L1271">124/5" class=4 cl0ONFIG_MMU" class="sre4">CON43 = 0;
phdrfilla>  la54" id="L1254"  r_fcla>  la54" id
s=get"dumphpag">14" id="L1254"  r_fclass="lesre">1167  e1323"f="+co2s="l="+code=DUMP_WRIT ="="line" name="L1271">124/5" clasPSINFO0ONFIG_MMU" class="sre4">CON43 = 0;
phdre="L1167">1167LIST_HEADco2s="l="+code=LIST_HEADfmt_m_              1" clasruc4_fileszEL5_DATA;
fillref">en.e_phentsize6"teno e2]eode=u TA" class="sr5f">EL5_DATA;
1167  u286" id="L1286""pulass; a           
tefze" class="sref4L EL5_DATA;
}
)   \

1167  xfpu286" id="L1286"x"pulass; a         
tefze" class="srignf4# int 1167  e1323"f="+co2s="l="+code=DUMP_WRITA" class="sr5f">EL5_DATA;
12804     48NOTE;
elf-6CONFI60ode=u    if (!e="L1167">1167258<1167" class="lEL5_DATA;
phdrfill60exttume="  lass=167">1167   rphdr-&gd="4extpelfnote" classpelf4id="=fof">1167  e1323"f="+co2s="l="+code=DUMP_WRITA" class="sr5f">EL5_DATA;
phdrfilla>  ref">phdr-&gd="4exttumecode=vma" class="sref">vma->4>(1167  e1323"f="+co2s="l="+code=DUMP_WRITA" class="sr5f">EL5_DATA;
phdre="L1167">1167EATAHa67" class="lfo49 = 0;
_copy_2asktrs="sr1167" class="lelf-&segssrefe1271" claset" class="sr4f">fo49 = 0;
ELF5OSABI;
124;mm_4lags
d4mp_ok
125#L1302" id5"L13llllllll*e=dump_ok" class="s4ef">d4mp_ok
1167  maydump2866 id="61286"mss" id="L1271" class="lllllllll* Thisa> =because those 5L+codes that could possibly cha ce map_coun" c_flags" class="sr4f">vm44hdr
124;e" c / vma fssss e=u now blocd="Lin do_exit oid=67">1167_flags" class="sr4f">vm44hdr
124;d4mp_ok
me61" L1212i/bormation for"" clallllllll*e=dump_ok" class="s4ef">d4mp_ok
124se memory "+biesdes, but it doesname="t cha cee=dump_ok" class="s4ef">d4mp_ok
161" clfinal cor>    ess="commellllllll* 124;eap_coun" 1">124;fssss ellocated. So no7possibilityme="arashinge=dump_ok" class="s4ef">d4mp_ok
124L1249" id=4L124llllllll* exists whil4=="+cing>124;e"lfnot5f="+co e=uas to>124;a h4=f="fde=dump_ok" class="s4ef">d4mp_ok
fi6l_elf62="L1271">125L1300" id=5L130lllllllll*NFIG_MMU" class="sre4">CON43 = 0;
fill_el6_s22"62offset" class="sr4f">fo49fset;
fil6_elf_622">1322  line" name="L1271">124/5"elloc memory e="Llarce data6atic iuies: tooLlarce to>be oids="ckl*NFIG_MMU" class="sre4">CON43 = 0;
1167  e1323"kmelloc" class="lfileeode=u    if (!EL5_DATA;
  dumphwriL1f="fs/binfmt_elf   e167" class="lEL5_DATA;
fo49 = 0;
11671d286" id="L1286"+r_fpvalfd="+c">1167  e1323"kzelloc" class="lfileeode=u    if (! *EL5_DATA;
e_phent6ize *EL5_DATA;
fo49 = 0;
116714" id="L1254"  r_fclass="lesre">1167  e1323"kmelloc" class="lfileeode=u    if (!EL5_DATA;
EL5_DATA;
      s22"gotosrIO286" id="L12cleanucovmasreft=href=cleanucclaset" class="sr4f">fo49 = 0;
  286" id6"L12863class="line" namsd="4exttumrde=alignf4# 1167  e1323"kmelloc" class="lfief="+1nt 132*umee" cmelfnote" classteno 286" id="L1286"teno e3]ode=u    if"+class="line" namGFP_KERNE+co2s="l="+code=GFP_KERNE+de=EITA" class="sr5f">EL5_DATA;
EL5_DATA;
->list"sref"sref">6n63>  dumphwriL1286" id=gotosrIO286" id="L12cleanucovmasreft=href=cleanucclaset" class="sr4f">fo49 = 0;
1167  e1323"kmelloc" class="lfileeode=u    if (! : <4"L1267" classclass="line" namGFP_KERNE+co2s="l="+code=GFP_KERNE+de=EITA" class="sr5f">EL5_DATA;
ph63e=DUMP_WRITE" nr : <4"L1267" clasA" class="sr5f">EL5_DATA;
fo49 = 0;
}
)   \
p63me="pxregset" lass=167">1167ignf4# int 1167  e1323"kmelloc" class="lfileeode=u    if (!EL5_DATA;
124t = <6 hre464addrss="sref"f="fs/binfmt_elf   eef="+co2s="l="+code=DUMP_WRIA" class="sr5f">EL5_DATA;
static int gotosrIO286" id="L12cleanucovmasreft=href=cleanucclaset" class="sr4f">fo49 = 0;
12804     48NOTE;
fo4fset))
 6 sizeof(struc4#L1244" id46L124464>  dumphwriL1f="frIO286" id="L12cprid="L1286"pss/bolpride=Eine" name="L"egssref"ig" id="L1254"  r_fcl"ig" idde=Eine" name="L"egssref"i_refed="L1254"  r_fcl"i_refedP_WRI_PAD" class="s5ef">E51);
_1" cla/a>ecode=vma" class="a href="+covmasrecde=u TA" class="sr5f">EL5_DATA;
filla>  1" class="linclass="l6+covmasreft=href=tmcclaset" class="sr4f">fo49 = 0;
);
      pag"lass="e="Lcurrclass="sref"a href="+covmasrecde=u ">1167  e1323">1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" classvmant l/a>_s="l"te" classvmant e" nerm_a>./binfmt_elf   ed/a>->5-fo49 = 0;
      pag"lasse"+cooooooooooooooooooooooooooooooooode=vma" class="a href="+covmasrecde=u Tode=vma" class="a href="+covmasrecde=u ">1167  e1323"> href="+covmasrecde=u    if (!E51);
6 286"65addrss="sref">memsekaddrsrefa=get"dumphpag">6+covmasreft=href=tmcclas">1167  e1323"kzelloc" class="lfileeode=u    if (!EL5_DATA;
      s22"a+code=pf="fs/binfmt_elf   e6+covmasreft=href=tmcclasIA" class="sr5f">EL5_DATA;
1322      s22"""""""""""""""""gotosrIO286" id="L12cleanucovmasreft=href=cleanucclaset" class="sr4f">fo49 = 0;
phdr->6fo4fset))
 6 sizeof(struc4nst char *46 href65>  dumphwriL1286" id="L1286"d/binfmt_elf   e6+covmasreft=href=tmcclas   if (!ec>1167  e1323"> href="+covmasrecde=u    if (!fo49 = 0;
e_pad/a>.e_pad/f">fi&f (!EL5_DATA;
 6 sizeof(struc4d int   286" id="L6286"165class="line" name4"L13242);
_copy_2asktrs="6ref">652      pag"lass="/binfmt_elf   e">e_pe="_eacha>.e_pe="_eachf">fief="+1nt e2]eode=u , &f (!E51);
      pag"lasse"+coooooooooatic ilass="sref">filla>  1" class="linclass="l6+covmasreft=href=tmcclaset" class="sr4f">fo49 = 0;
memsekaddrsrefa&line" name="L1271">z="L1254"  r_fcl"zclaset" class="sr4f">fo49 = 0;
fo49fset;
1322      s22"""""""""=get"dumphpag">6+covmasreft=href=tmcclas">1167  e1323"">e_p>11rya>.e_p>11ryf">fief="+1nt e2]eode=u , atic ilass="sref">filla>  1" class="linclass="lEL5_DATA;
phdr->z="L1254"  r_fcl"zclasTE" fhsda hrdxref">ph"132el1" class="linclass="lfief="+1nt EL5_DATA;
 6 sizeof(struc4Lst char *46ode=e66>  dumphwriL1286" id="L1286"d/binfmt_elf   e6h class="linclass="lfo49 = 0;
);
(124/5"now colle il124;e" naf1">124;167">11l*NFIG_MMU" class="sre4">CON43 = 0;
1167fill/a>  286" id="L1286"+r  286"f">fief="+1nt  *1323  mmlasse="L1167">1167prid="L1286"pss/bolpride=Eine" name="L"egssref"ig" id="L1254"  r_fcl"ig" idde=Eine" name="L"egssref"i_refed="L1254"  r_fcl"i_refedP_WRITA" class="sr5f">EL5_DATA;
phdr6><6 =+code=phdr"  fhsda hrdxref">ph"l/a>_copy_r124>     int 4L128>ph"l/a>_copy_r124f">fi&f (! *_r1267prid="L1286"pss/bolpride=Eine" name="L"egssrefr124>     int 4L128r124f">fITA" class="sr5f">EL5_DATA;
fo49fset;
1167  e1323">1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" classvmant fo49 = 0;
67#ar"L1167" clclass_extratpelf4>     int 4L128>ph"l/a>_extratpelf4f">fiITA" class="sr5f">EL5_DATA;
 6mt_elf="+ccor>_copy_2askt6"preg67+code=name" class4"sref45RENT;
124/5"f1">4ode= se iionl*NFIG_MMU" class="sre4">CON43 = 0;
e="L1167">1167>124>     int 4L1285" class++TA" class="sr5f">EL5_DATA;
);
phdr6><67f-&="+ccorine" name="L1271">124/5"If"L12s"ass="PN_XNUM(0xffff),> : <4+cpde=f overflows. To a" naFIG_MMU" class="sre4">CON43 = 0;
,6124L1249" id=4L12444444444*>12> , kernel supports extended e=fbering. Have a look a167_flags" class="sr4f">vm44hdr
124" cla6s="l468="L1271">125L1300" id=5L130l44444444*>include/127ux/hdr.h"f1">fur : r " idrme="L1.l*NFIG_MMU" class="sre4">CON43 = 0;
phdr-6gt;11671167  e1323">124>     int 4L1285" class"ass="167  e1323"PN_XNUM>     int 4L128PN_XNUMlass"?"167  e1323"PN_XNUM>     int 4L128PN_XNUMlass":ne" name="L1271">124>     int 4L1285" class7        4     49ma;
E5_CORE;
124/5"Set up hent r *NFIG_MMU" class="sre4">CON43 = 0;
 6ame="L1328"exttum_s/bo2866 id="68exttume="L1167">1167fill/ = 0;_hent r id="L1286"+r = 0;_hent rf">fief="+1nt EL5_DATA;
)) {
vma->4>elf_note<6a> e="L1167">1167hase="+c286"gfda> =esref"hase="+c281" clEN1TA" class="sr5f">EL5_DATA;
1167>1323  mmlasse="L1167">1167  mman286" id="L12L1271">125= 12804     48NOTE;
124;mm_4lags
125L1300" id=5L130l44444444*>Set up 124;4ode= in similar"f1"m to>SVR4=a h4=="+cs mnt m_flags" class="sre4">mm_4lags
d4mp_ok
125#L1302" id5"L13llllllll*NFIG_MMU" class="sre4">CON43 = 0;
fo4fset))
phdre="L1167">1167fill/id="L1286"teno fill/id="f">fief="+1nt  125#L130string">"href"FIG_MMUTElass="line" nam class=4 clignf4# eeode=u    if (! * *6mtsd="4exttumref">phdrefze" class="sreill/a4" id="L1254"  r_fcleill/a4" idf">fief="+1nt 1323  mmlasse="L1167">1167  mman286" id="L12group_lent r id="L1286"+r1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" "7        4     49ma;
phdre="L1167">1167fill/id="L1286"teno fill/id="f">fief="+1nt  125#L130string">"href"FIG_MMUTElass="line" nam clasPSINFOignf4# eeode=u    if (!        4     49ma;
phdr);
-&="+ccor>_copy_2asktrsnum href="+co2s="l="+cnum hre1" clEN27        4     49ma;
ELF5OSABI;
1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" classvmant         4     49ma;

fo49fset;
elf-7CONFI70ode=u    if (do class="sref5>EV_C50258};
phdr  dumphwriL1286" id=namsd="4exttumri.        4     49ma;
phdrfill70exttume="whil4=ief="+1nt .        4     49ma;
phdre="L1167">1167fill/id="L1286"teno fill/id="f">fi&f (!125#L130string">"href"FIG_MMUTElass="line" nam clAUXVignf4#         4     49ma;
phdr        4     49ma;
12804     48NOTE;
124;CON43 = 0;
 * =esref"pr_fpvali8lasslE" class="sre4">CON43 = 0;
ph"l/a>_copy_tass       >     int 4L128>ph"l/a>_copy_tass       f">fief="+1nt   mmlasse="L1167">1167prid="L1286"pss/bolpride=Eine" name="L"egssrefr124>     int 4L128r124f">f class="line" namf.4#span> : <4"L1267" clasRCH" class="sr5f">EL51)   \
1322      s22"L1167">1167fill/id="L1286"teno fill/id="f">fief="+1nt          4     49ma;
1167  maydump2867 id="71#ar"L1167" class="lass cl71">125#L130string">"href"FIG_MMUTElass="line" nam clas=foffignf4# eeode=u    if (! : <4"L1267" classclass="line" namc.4#span> : <4"L1267" clas7        4     49ma;
}
)   \
ph"l/a>_copy_tass x      >     int 4L128>ph"l/a>_copy_tass x      f">fief="+1nt   mmlasse="L1167">1167EL51)   \
me7186" id="L1286"kunman"L1167">1167fill/id="L1286"teno fill/id="f">fief="+1nt          4     49ma;
 cl71">125#L130string">"LINUX"FIG_MMUTElass="line" nam4     int 4L1284eeode=u    if (!171" clfe="L1280">12804     48NOTE;
ELF5OSABI;
fi7l_elf72=+code=phdr"  fhsda hrdxref"fa href="+co2s="l=">129">1167  e1323"get_fa href="+co2s="lget_faf">fiITA" class="sr5f">EL5_DATA;
fill_el7_s22"721e="pxregset" lass=167">1167set_fa href="+co2s="lset_faf">fi lass=167">1167KERNE+_Dinfmt_elf_fdpic.KERNE+_DiP_WRI7        4     49ma;
fil7_elf_72ET_CORE" class="s5ef">E5_CORE;
ecodeoffset1" cl+ENleeode=u    if (! cl71">125#L130ef="4code=m Elf hent r *NFIG_MMU" class="sre4">CON43 = 0;
e="L1167">1167offset  s22"ecodeoffset1" cl+EN167  e1323">124>     int 4L1285" class"*umee" cmelfnote" classtenoaef">phdr-&gd="4extpelfnote);=u     l71">125#L130ef="4code=m Program hent rs *NFIG_MMU" class="sre4">CON43 = 0;
ecodefoffset1" c">1167  e1323"offset  s22"ecodeoffset1" c7        4     49ma;
        4     49ma;
e_phent7ize125#L130ef="4code=m Writ4;4ode= pelf >11ry *NFIG_MMU" class="sre4">CON43 = 0;
E51);
      pag"lasse"+co&line" name="L1271">z="L1254"  r_fcl"zclaslENT" class="sref5>EV_C50258};
      s22"e="Lcurrclass="sref"i..  e1323"num href="+co2s="l="+cnum hre1" cTenamsd="4exttumri.EL51)   \
  286" id7"L128732">1322      s22"""""""""=get"dumphpag">>z="L1254"  r_fcl"zclasl+EN167  e1323"4ode=ass="lfief="+1nt  .        4     49ma;
fo4fset))
->list"sref"sref">7n73>  dumphwriL1286" id==get"dumphpag">>z="L1254"  r_fcl"zclasl+EN167  e1323"6h class="linclass="l        4     49ma;
)) {
ph7386" id="L1286"kunman"L1167">1167pelf4id="L1286"teno pelf4id="=fof">1167  e1323"kmelloc" class="lfileeode=u    if (!pelf4id="=fofITElass="line" namGFP_KERNE+co2s="l="+code=GFP_KERNE+de=EITA" class="sr5f">EL5_DATA;
pelf4id="=fofIA" class="sr5f">EL5_DATA;
e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
p73OSABI" class="sre5">ELF5OSABI;
124t = <7 hre474addrss="sref">memsekaL1167">1167fill/SABIid=">aef">phdr-&gd="fill/SABIid=">aef"f">fief="+1nt pelf4id="=fofTElass="line" nam>z="L1254"  r_fcl"zclasTElass="line" namoffset  s22"ecodeoffset1" cITA" class="sr5f">EL5_DATA;
static int L1167">1167offset  s22"ecodeoffset1" cl+EN167  e1323">z="L1254"  r_fcl"zclaset" class="sr4f">fo49 = 0;
1322  +code=en" cla3s="sr381326}
fo4fset))
 7 sizeof(struc4#L1244" id47L124474>  dumphwriL1l71">125#L130ef="4code=m Page-alignne" ned data6*NFIG_MMU" class="sre4">CON43 = 0;
1167  e1323"offset  s22"ecodeoffset1" c">1167  e1323"rounducovmasreft=href=rounducf">fief="+1nt ecodeoffset1" cTElass="line" nam4     int 4L1284EL5_DATA;
        4     49ma;
e="L1167">1167offset  s22"ecodeoffset1" cl+EN167  e1323">ph"l/a>_vma_dataclass="l_vma_dataclassf">fief="+1nt 125= EL5_DATA;
-&="+ccor>_copy_2asktrsoffset  s22"ecodeoffset1" cl+EN167  e1323">ph"l/a>_extratdataclass="l_extratdataclassf">fiITA" class="sr5f">EL5_DATA;
1167elf-&segssrefe1271" clas">1167  e1323"offset  s22"ecodeoffset1" c7        4     49ma;
7 286"75addrs class="sref5>EV_C50258};
      f="f fhsda hrdxref">tpelignf4#     int 4"+cpde=foffs">de=vma" class="sreN_XNUM>     int 4L128PN_XNUMlassI_PAD" class="s5ef">E51);
1322      s22"167  e1323">ref">vma->4>(1167  e1323"kmelloc" class="lfileeode=u    if (!ref">vma->4>(EL5_DATA;
phdr->7ref">vma->4>(EL5_DATA;
 7 sizeof(struc4nst char *47 href75>  dumphwriL1286" id="L1286"dgotosrIO286" id="L12="L_e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
1167fill/Scode=_" id="L1254"  r_fcleill/Scode=_" idf">fief="+1nt ref">vma->4>(elf-&segssrefe1271" clasTElass="line" nam>124>     int 4L1285" classITA" class="sr5f">EL5_DATA;
  286" id="L7286"175class="line" name4"L13242);
_copy_2asktrs="7ref">75f-&="+ccor>_copy_2asktrsoffset  s22"ecodeoffset1" cl>1167  e1323"datalignf4>span> : <4fdatalig271"TA" class="sr5f">EL5_DATA;
ELF5OSABI;
eeode=u    if (!ELF5OSABI;
span> : <4fd32elwrit4f">fief="+1nt eeode=u    if (!EL51)   \
1322      s22"gotosrIO286" id="L12="L_e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
phdr->fo4fset))
 7 sizeof(struc4Lst char *47ode=e76exttume="L1167">1167lass="leeode=u    if (!pelf4id="=fofI7        4     49ma;
        4     49ma;
span> : <4fd32elwrit4f">fief="+1nt pelf4id="=fofTEleeode=u    if (!pelf4id="=fofIICH" class="sr5f">EL51)   \
e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
(12804     48NOTE;
124;e" na*NFIG_MMU" class="sre4">CON43 = 0;
phdr7><7 =+code=phdr" e="Lcurrclass="sref"vma>phdr-&gd="vma1" cl>1167  e1323">1323  mmlasse="L1167">1167  mman286" id="L1286"mman" clremelfnote" classvmant 1167  e1323"vma>phdr-&gd="vma1" cclassvmant phdr-&gd="vm_"+code=EI_PAD" class="s5ef">E51);
      s22"  lass=167">1167   rphdr-&gd="4extpelfnote"de=u    if (!pelf1" c7        4     49ma;
1322      s22"167  e1323">z="L1254"  r_fcl"zclaset" class="sr4f">fo49 = 0;
77offset" class="sr4f">fo4fset))
 7mt_elf="+ccor>_copy_2askt7"preg77>  dumphwriL1286" id==get"dumphpag">>z="L1254"  r_fcl"zclasl>1167  e1323"vma>phdr-&gd="vma1" cclassvmant phdr-&gd="vm_4"Lclasl-1167  e1323"vma>phdr-&gd="vma1" cclassvmant fo49 = 0;
)) {
1167pelfL1286"teno pelf1" c./binfmt_elf   ep_typ"L1286"teno p_typ"clasl>1167  e1323"PT_LOAD>     int 4L128PT_LOADclaset" class="sr4f">fo49 = 0;
1167pelfL1286"teno pelf1" c./binfmt_elf   ep_offset  s22"ecodep_offsetclas">1167  e1323"offset  s22"ecodeoffset1" c7        4     49ma;
phdr7><772      pag"lass="/binfmt_elf   epelfL1286"teno pelf1" c./binfmt_elf   ep_v"+bi  s22"ecodep_v"+biclasl>1167  e1323"vma>phdr-&gd="vma1" cclassvmant fo49 = 0;
,7      pag"lasse"+co/binfmt_elf   epelfL1286"teno pelf1" c./binfmt_elf   ep_p"+bi  s22"ecodep_p"+biclasl>1T" class="sref5>EV_C50258};
124" cla7s="l478addrss="sref">memsekaL1167">1167pelfL1286"teno pelf1" c./binfmt_elf   ep_eil">z="L1254"  r_fclp_eil">zclasl>1167  e1323"maye=u >phdr-&gd="maye=u f">fief="+1nt phdr-&gd="vma1" cTElass="line" nam>prid="L1286"pss/bolpride=Eine" name="L"egssrefmm_L1271">125=   e1323">z="L1254"  r_fcl"zclasl:1T" class="sref5>EV_C50258};
phdr-7gt;      s22"L1167">1167pelfL1286"teno pelf1" c./binfmt_elf   ep_mem>z="L1254"  r_fclp_mem>zclasl>1167  e1323">z="L1254"  r_fcl"zclaset" class="sr4f">fo49 = 0;
1322      s22"167  e1323"offset  s22"ecodeoffset1" cl+EN167  e1323"pelfL1286"teno pelf1" c./binfmt_elf   ep_eil">z="L1254"  r_fclp_eil">zclaset" class="sr4f">fo49 = 0;
pelf1" c./binfmt_elf   ep_e1271">125= 1167  e1323"vma>phdr-&gd="vma1" cclassvmant 125=   e1323"VM_READ>     int 4L128VM_READ1" c ?"167  e1323"PF_R>     int 4L128PF_Rclasl:1T" class="sref5>EV_C50258};
 7ame="L1328"exttum_s/bo2867 id="78>  dumphwriL1286" id=f="f fhsda hrdxref"vma>phdr-&gd="vma1" cclassvmant 125=   e1323"VM_WRITf>     int 4L128VM_WRITffoffIA" class="sr5f">EL5_DATA;
pelf1" c./binfmt_elf   ep_e1271">125= fo49 = 0;
vma->4>elf_note<7a> phdr-&gd="vma1" cclassvmant 125=   e1323"VM_EXEC>     int 4L128VM_EXECfoffIA" class="sr5f">EL5_DATA;
/binfmt_elf   epelfL1286"teno pelf1" c./binfmt_elf   ep_e1271">125= fo49 = 0;
pelf1" c./binfmt_elf   ep_align">125= 1167  e1323"4     int 4L1284fo49 = 0;
ELF5OSABI;
memsekaL1167">1167lass="lee/binfmt_elf   epelfL1286"teno pelf1" cI7        4     49ma;
      s22"f="f fhsda hrdxref"lass="l        4     49ma;
1322      s22"""""|| s/binfmt_elf   e132elwrit4nf4>span> : <4fd32elwrit4f">fief="+1nt pelf1" c,elee/binfmt_elf   epelfL1286"teno pelf1" cIICH" class="sr5f">EL51)   \
e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
phdre="+code=en" cla3s="sr381326}
phdr)) {
phdrph"l/a>_writ4_extratpelf4>     int 4L128>ph"l/a>_writ4_extratpelf4f">fief="+1nt ecodeoffset1" cTE&f (!prid="L1286"pss/bolpride=Eine" name="L"egssreflimi4_fileszEL51)   \
phdre=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
12804     48NOTE;
124;CON43 = 0;
..  e1323"num href="+co2s="l="+cnum hre1" cTenamsd="4exttumri.EL51)   \

      s22"f="fs/binfmt_elf   ewrit4 href="+co2s="l="+cwrit4 href">fief="+1nt  .prid="L1286"pss/bolpride=Eine" name="L"egssreff="f="L1254"  r_fcleil"=fofTE&f (!ecodefoffset1" cICH" class="sr5f">EL51)   \
1322      s22"""""""""gotosrIO286" id="L12="L_e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
elf-8CONFI80offset" class="sr4f">fo4fset))
phdr  dumphwriL1l71">125#L130ef="4code=m writ4 out 124;1" cla s="lin;4ode= se iionl*NFIG_MMU" class="sre4">CON43 = 0;
phdrfill80exttume="name="L"egssreflie_pe="_eacha>.e_pe="_eachf">fief="+1nt e2]eode=u , &f (!E51);
phdrfilla>  1" class="linclass="l6+covmasreft=href=tmcclaslE" class="sre4">CON43 = 0;
phdr11rya>.e_p>11ryf">fief="+1nt e2]eode=u , atic ilass="sref">filla>  1" class="linclass="lEL5_DATA;
12804     48NOTE;
..  e1323"t+covmasreft=href=tmcclas   if (!EL51)   \
memsekaddrsrefa&="fs/binfmt_elf   ewrit4 href="+co2s="l="+cwrit4 href">fi&f (! .prid="L1286"pss/bolpride=Eine" name="L"egssreff="f="L1254"  r_fcleil"=fofTE&f (!ecodefoffset1" cICH" class="sr5f">EL51)   \
      s22"""""""""gotosrIO286" id="L12="L_e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
1322  +code=en" cla3s="sr381326}
1167  maydump2868 id="81offset" class="sr4f">fo4fset))
  dumphwriL1&="fs/binfmt_elf   ed32elsees="lfief="+1nt span> : <4fdatalig271""-1167  e1323"eoffset  s22"ecodefoffset1" cICH" class="sr5f">EL51)   \
e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
me81exttu        4     49ma;
ph"a/a>;_d32else "4cosclass="l;_d32else "4cosf">fief="+1nt         4     49ma;
1812      pag"lass=""""""""""""""""""""" (!125= EL51)   \
e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
fi8l_elf82addrs class="sref5>EV_C50258};
fill_el8_s22"82322      f="fs/binfmt_elf   e>ph"l/a>_writ4_extratdata>     int 4L128>ph"l/a>_writ4_extratdataf">fief="+1nt prid="L1286"pss/bolpride=Eine" name="L"egssreflimi4_fileszEL51)   \
fil8_elf_822">1322      s22"gotosrIO286" id="L12="L_e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
fo4fset))
  dumphwriL1&="frIO286" id="L12=tpelignf4#     int 4"+cpde=foffs">de=vma" class="sreN_XNUM>     int 4L128PN_XNUMlassI_PAD" class="s5ef">E51);
1167lass="leeode=u    if (!ref">vma->4>(        4     49ma;
        4     49ma;
e_phent8izespan> : <4fd32elwrit4f">fief="+1nt ref">vma->4>(        4     49ma;
eeode=u    if (!ref">vma->4>(EL51)   \
      pag"lasse"+co    s22"gotosrIO286" id="L12="L_e=u >phdr-&gd="4"L_e=u 1" c7        4     49ma;
fo49fset;
  286" id8"L128832">1322  f="f fhsda hrdxref"cprid="L1286"pss/bolpride=Eine" name="L"egssreff="f="L1254"  r_fcleil"=fofine" name="L"egssreff_poa href="+co2s="l=_poa">132!de=vma" class="sroffset  s22"ecodeoffset1" cI_PAD" class="s5ef">E51);
124/5"Sanity checkl*NFIG_MMU" class="sre4">CON43 = 0;
->list"sref"sref">8n83>  dumphwriL1286" id==get"dumphpag">prints="lfief="+1nt  fo49fset;
125#L130string">">ph"l/a>_e=u : eil"ine" =_poa (%lld)2!deoffset (%lld)\n"FIG_MMUTt" class="sr4f">fo49fset;
ph8386" id="L1286"kunman"86" id==get"dumphpag">cprid="L1286"pss/bolpride=Eine" name="L"egssreff="f="L1254"  r_fcleil"=fofine" name="L"egssreff_poa href="+co2s="l=_poa">13TElass="line" namoffset  s22"ecodeoffset1" cITA" class="sr5f">EL5_DATA;
83a hre80">12804     48NOTE;
p83OSABIrIO286" id="L12="L_e=u >phdr-&gd="4"L_e=u 1" c:80">12804     48NOTE;
124t = <8 hre484=+code=phdr"  fhsda hrdxref"let_fa href="+co2s="lset_faf">fi lass=167">1167fa href="+co2s="l=">129ITA" class="sr5f">EL5_DATA;
static int fo49fset;
13=get"dumphpag">cleanucovmasreft=href=cleanuc1" c:80">12804     48NOTE;
e_p>mptya>.e_p>mptyf">fi&f (!E51);
 8 sizeof(struc4#L1244" id48L124484>  dumphwriL1286" id=atic ilass="sref">fill">e_phenta>.e_phentsize6+covmasreft=href=tmcclaslEN167  e1323"6h clasruc4_fileszphdr-&gd=""+code=ETA" class="sr5f">EL5_DATA;
1167">e_pdela>.e_pdelf">fief="+1nt EL5_DATA;
1167kfref="L1254"  r_fclkfreff">fief="+1nt 11rya>.e_p>11ryf">fief="+1nt filla>  1" class="linclass="lEL5_DATA;
-&="+ccor>_copy_2asktrskfref="L1254"  r_fclkfreff">fief="+1nt pelf4id="=fofI7        4     49ma;
1167kfref="L1254"  r_fclkfreff">fief="+1nt ELF5OSABI;
8 286"85=+code=phdr"  fhsda hrdxref"kfref="L1254"  r_fclkfreff">fief="+1nt  *1167kfref="L1254"  r_fclkfreff">fief="+1nt         4     49ma;
1322   lass=167">1167kfref="L1254"  r_fclkfreff">fief="+1nt          4     49ma;
phdr->81167kfref="L1254"  r_fclkfreff">fief="+1nt  : <4"L1267" clas7        4     49ma;
 8 sizeof(struc4nst char *48 href85>  dumphwriL1 lass=167">1167kfref="L1254"  r_fclkfreff">fief="+1nt ref">vma->4>(        4     49ma;
}
)   \
e="L1167">1167kfref="L1254"  r_fclkfreff">fief="+1nt   286" id="L8286"185classe="L1280">12804     48NOTE;
_copy_2asktrs="8ref">85f-&="+ccoreturn"L1167">1167has_e" ned+co2s="l="+codehas_e" nedde=ETA" class="sr5f">EL5_DATA;
)   \
(fo49fset;
13e="L1286"kunman"Line" name="L1271">124/5"CONFIG_4CON43 = 0;
phdr->


phfooder"> The original LXR software by 124; class="shttp://sourceforge.net/projects/lxr">LXR 1271unitysizeTEthis experi1">1al versionlby class="smailto:lxr@dr phsubfooder"> rxr.dr