Date: Tue, 3 Sep 2002 21:46:01 +0200 From: Thomas Moestl <tmoestl@gmx.net> To: John Baldwin <jhb@FreeBSD.org> Cc: dillon@freebsd.org, current@FreeBSD.ORG, des@FreeBSD.ORG, ticso@cicely5.cicely.de, Alexander Kabaev <ak03@gte.com>, ticso@cicely.de, Peter Wemm <peter@wemm.org> Subject: Re: alpha tinderbox failure - kernel is broken. Message-ID: <20020903194601.GD441@crow.dom2ip.de> In-Reply-To: <XFMail.20020903151106.jhb@FreeBSD.org> References: <20020903175819.GA441@crow.dom2ip.de> <XFMail.20020903151106.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2002/09/03 at 15:11:06 -0400, John Baldwin wrote: > > On 03-Sep-2002 Thomas Moestl wrote: > > On Tue, 2002/09/03 at 09:37:14 -0700, Peter Wemm wrote: > >> Bernd Walter wrote: > >> > On Tue, Sep 03, 2002 at 09:01:07AM -0700, Peter Wemm wrote: > >> > I was running -current from 2002/08/11 before without any sign about > >> > this kind of problem. > >> > Building libiconv failed reproduceable for me, but booting an > >> > 2002/08/11 kernel made me build the port. > >> > >> Yes, imgact_elf.c rev 1.121 is the culprit. Reverting that change solves > >> the problem. > > > > Can somebody who is feeling adventurous and has an alpha box please > > test whether this fixes it for now? > > Nope, if anything it's now worse. :( We should perhaps revert this > change in -stable until we can get it to work in -current. FWIW, with > the patch all sorts of programs no longer work including find, > rpc.lockd, cron, sendmail, getty, etc., not just static c++ programs. Thanks for testing, and sorry! This time, I broke dynmically linked programs :) It turns out that only C++ programs actually had their text segments mapped writable; dynamically linked programs have their data segment mapped executable though (contrary to what I said before, the PLT is actually included in the data segment, sorry). So, protections cannot be used to discriminate between text and data. I have attached a a new workaround patch that uses the old method to find the text segment again (i.e. finding the entry point), and treats everything else as data. This time it's tested (thanks to jhb) and actually seems to work. - Thomas -- Thomas Moestl <tmoestl@gmx.net> http://www.tu-bs.de/~y0015675/ <tmm@FreeBSD.org> http://people.FreeBSD.org/~tmm/ PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C Index: imgact_elf.c =================================================================== RCS file: /home/ncvs/src/sys/kern/imgact_elf.c,v retrieving revision 1.124 diff -u -r1.124 imgact_elf.c --- imgact_elf.c 2 Sep 2002 17:27:30 -0000 1.124 +++ imgact_elf.c 3 Sep 2002 19:11:58 -0000 @@ -734,18 +734,20 @@ phdr[i].p_vaddr - seg_addr); /* - * Is this .text or .data? Use VM_PROT_WRITE - * to distinguish between the two for the purpose - * of limit checking and vmspace fields. + * Check whether the entry point is in this segment + * to determine whether to count is as text or data. + * XXX: this needs to be done better! */ - if (prot & VM_PROT_WRITE) { + if (hdr->e_entry >= phdr[i].p_vaddr && + hdr->e_entry < (phdr[i].p_vaddr + + phdr[i].p_memsz)) { + text_size = seg_size; + text_addr = seg_addr; + entry = (u_long)hdr->e_entry; + } else { data_size += seg_size; if (data_addr == 0) data_addr = seg_addr; - } else { - text_size += seg_size; - if (text_addr == 0) - text_addr = seg_addr; } /* @@ -762,12 +764,6 @@ goto fail; } - /* Does the entry point belong to this segment? */ - if (hdr->e_entry >= phdr[i].p_vaddr && - hdr->e_entry < (phdr[i].p_vaddr + - phdr[i].p_memsz)) { - entry = (u_long)hdr->e_entry; - } break; case PT_PHDR: /* Program header table info */ proghdr = phdr[i].p_vaddr; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020903194601.GD441>