From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 24 19:29:26 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D56C1065672 for ; Wed, 24 Mar 2010 19:29:26 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from argol.doit.wisc.edu (argol.doit.wisc.edu [144.92.197.212]) by mx1.freebsd.org (Postfix) with ESMTP id 13C188FC14 for ; Wed, 24 Mar 2010 19:29:25 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0KZS0080CWT14100@smtpauth3.wiscmail.wisc.edu> for freebsd-hackers@freebsd.org; Wed, 24 Mar 2010 14:29:25 -0500 (CDT) Received: from comporellon.tachypleus.net ([unknown] [76.210.69.218]) by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0KZS00155WSZP3A0@smtpauth3.wiscmail.wisc.edu> for freebsd-hackers@freebsd.org; Wed, 24 Mar 2010 14:29:24 -0500 (CDT) Date: Wed, 24 Mar 2010 14:29:23 -0500 From: Nathan Whitehorn To: freebsd-hackers@freebsd.org Message-id: <4BAA6813.7060604@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.69.218 X-Spam-PmxInfo: Server=avs-11, Version=5.5.5.374460, Antispam-Engine: 2.7.1.369594, Antispam-Data: 2010.3.24.191821, SenderIP=76.210.69.218 User-Agent: Thunderbird 2.0.0.24 (X11/20100320) Subject: Review/testing request: changing the detection of data_addr/text_addr X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Mar 2010 19:29:26 -0000 We currently detect the offical "text" and "data" addresses for ELF files in kern/imgact_elf.c by the heuristic of calling whichever section contains the executable's entry point the text section and everything else data. In general, both this concept and the very few things that use them are obsolete and rare. The data addresses are, however, used in obreak() to find the current break. On powerpc64, this logic fails, because the entry point points to a function descriptor in the data section, causing sbrk() to fail, which in turn breaks profiling. The patch at http://people.freebsd.org/~nwhitehorn/textseg.diff changes this algorithm to make the official text area be the largest executable segment, and all others data. The patch has been tested on sparc64, amd64, powerpc, and (of course) powerpc64, with no evident bad effects. I would appreciate any comments, as well as tests on other architectures. The main symptom of getting these values wrong is that sbrk() stops working correctly, so I have put a simple test program for sbrk() at http://people.freebsd.org/~nwhitehorn/sbrktest.c. -Nathan