From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13738 invoked by alias); 27 Apr 2004 20:48:49 -0000 Mailing-List: contact sid-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sources.redhat.com Received: (qmail 13731 invoked from network); 27 Apr 2004 20:48:48 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 27 Apr 2004 20:48:48 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i3RKmmKG002209 for ; Tue, 27 Apr 2004 16:48:48 -0400 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i3RKmlv16211 for ; Tue, 27 Apr 2004 16:48:47 -0400 Received: from redhat.com (IDENT:01wsFyZToWEwXrYrHc8JyzqSDbQ1Dttt@topaz.toronto.redhat.com [172.16.14.227]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id i3RKmlcU000944 for ; Tue, 27 Apr 2004 16:48:47 -0400 Message-ID: <408EC72F.2030102@redhat.com> Date: Tue, 27 Apr 2004 20:48:00 -0000 From: Dave Brolley Organization: Red Hat Canada, Ltd User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040421 MIME-Version: 1.0 To: sid@sources.redhat.com Subject: [patch] Check Section Table in Loader component Content-Type: multipart/mixed; boundary="------------030404020306080105030206" X-SW-Source: 2004-q2/txt/msg00007.txt.bz2 This is a multi-part message in MIME format. --------------030404020306080105030206 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 221 I've committed the attached patch which checks that the section table has been allocated in the loader before attempting to use it. This can happen for ports which initialize memory before the program is loaded. Dave --------------030404020306080105030206 Content-Type: text/plain; name="sid-loader.ChangeLog" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sid-loader.ChangeLog" Content-length: 186 2004-04-27 Dave Brolley * elfload.c (textSectionAddress): Check section table before accessing. * compLoader.cxx (loader_probe_bus): Initialize section_table. --------------030404020306080105030206 Content-Type: text/plain; name="sid-loader.patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sid-loader.patch.txt" Content-length: 1598 Index: sid/component/loader/compLoader.cxx =================================================================== RCS file: /cvs/src/src/sid/component/loader/compLoader.cxx,v retrieving revision 1.7 diff -c -p -r1.7 compLoader.cxx *** sid/component/loader/compLoader.cxx 12 Feb 2004 20:30:08 -0000 1.7 --- sid/component/loader/compLoader.cxx 27 Apr 2004 20:20:27 -0000 *************** class loader_probe_bus: public sidutil:: *** 68,74 **** public: loader_probe_bus (sid::bus **t, output_pin *p) : sidutil::passthrough_bus (t), ! write_to_code_address_pin (p) { assert (t); } --- 68,75 ---- public: loader_probe_bus (sid::bus **t, output_pin *p) : sidutil::passthrough_bus (t), ! write_to_code_address_pin (p), ! section_table (0) { assert (t); } Index: sid/component/loader/elfload.c =================================================================== RCS file: /cvs/src/src/sid/component/loader/elfload.c,v retrieving revision 1.8 diff -c -p -r1.8 elfload.c *** sid/component/loader/elfload.c 26 Feb 2004 16:44:40 -0000 1.8 --- sid/component/loader/elfload.c 27 Apr 2004 20:20:27 -0000 *************** newTextSection (int index) *** 57,62 **** --- 57,66 ---- int textSectionAddress (unsigned long long address, const struct TextSection *section_table) { + // Not a text section address if there is no table. + if (! section_table) + return 0; + /* The table begins with the given pointer and is terminated by an entry with zeroes for both the high and low bounds. */ int i; --------------030404020306080105030206--