Date: Sat, 20 Mar 2010 18:55:54 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r205390 - projects/ppc64/sys/kern Message-ID: <201003201855.o2KItsWR059179@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sat Mar 20 18:55:54 2010 New Revision: 205390 URL: http://svn.freebsd.org/changeset/base/205390 Log: Remove a hack of questionable continuing relevance, though checks will be needed on all architectures before this can go into HEAD. The ELF image activator used the segment containing the image entry point as the official text segment, and the last other loadable segment as the official data segment, instead of checking whether the segments were executable. This was apparently required for Alpha support. On PPC64, the executable entry point points to a non-executable function descriptor in the .opd data section, which breaks this logic. As we no longer support Alpha, it may now be safe to turn off this hack. Modified: projects/ppc64/sys/kern/imgact_elf.c Modified: projects/ppc64/sys/kern/imgact_elf.c ============================================================================== --- projects/ppc64/sys/kern/imgact_elf.c Sat Mar 20 17:37:22 2010 (r205389) +++ projects/ppc64/sys/kern/imgact_elf.c Sat Mar 20 18:55:54 2010 (r205390) @@ -832,26 +832,14 @@ __CONCAT(exec_, __elfN(imgact))(struct i phdr[i].p_vaddr + et_dyn_addr - seg_addr); /* - * Is this .text or .data? We can't use - * VM_PROT_WRITE or VM_PROT_EXEC, it breaks the - * alpha terribly and possibly does other bad - * things so we stick to the old way of figuring - * it out: If the segment contains the program - * entry point, it's a text segment, otherwise it - * is a data segment. - * - * Note that obreak() assumes that data_addr + - * data_size == end of data load area, and the ELF - * file format expects segments to be sorted by - * address. If multiple data segments exist, the - * last one will be used. + * Make the largest executable segment the official + * text segment and all others data. The data_addr + * and data_size parameters are used for obreak(). */ - if (hdr->e_entry >= phdr[i].p_vaddr && - hdr->e_entry < (phdr[i].p_vaddr + - phdr[i].p_memsz)) { + + if (phdr[i].p_flags & PF_X && text_size < seg_size) { text_size = seg_size; text_addr = seg_addr; - entry = (u_long)hdr->e_entry + et_dyn_addr; } else { data_size = seg_size; data_addr = seg_addr; @@ -871,6 +859,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i data_size = text_size; } + entry = (u_long)hdr->e_entry + et_dyn_addr; + /* * Check limits. It should be safe to check the * limits after loading the segments since we do
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003201855.o2KItsWR059179>