NetBSD Problem Report #38170
From martin@duskware.de Wed Mar 5 08:40:08 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 8BD6E63B882
for <gnats-bugs@gnats.netbsd.org>; Wed, 5 Mar 2008 08:40:08 +0000 (UTC)
Message-Id: <20080305051534.1AB2563B88C@narn.NetBSD.org>
Date: Wed, 5 Mar 2008 05:15:34 +0000 (UTC)
From: abutter.gao@gmail.com
Reply-To: abutter.gao@gmail.com
To: netbsd-bugs-owner@NetBSD.org
Subject: Probable incorrect calculation of esym in multiboot.c on i386/amd64 platform
X-Send-Pr-Version: www-1.0
>Number: 38170
>Category: port-i386
>Synopsis: Probable incorrect calculation of esym in multiboot.c on i386/amd64 platform
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: jmmv
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 05 08:45:01 +0000 2008
>Closed-Date: Sat Mar 22 16:51:44 +0000 2008
>Last-Modified: Sat Mar 22 16:55:02 +0000 2008
>Originator: Gao Ya'nan
>Release: NetBSD-4.0 and NetBSD-current
>Organization:
None
>Environment:
None
>Description:
When booting the NetBSD kernel by a Multiboot-compliant boot loader with MULTIBOOT_INFO_HAS_ELF_SYMS flag in mi_flags, the kernel will find symaddr and strtab and store the end of the last section between them to esym. But the esym is calculated as below :
*RELOC(int *, &esym) = (int)(strstart + strsize + KERNBASE);
so the 'esym' is just the end of strtab but not the "lowest 'free' address after the tables" when the symtab is copied behind the strtab.
>How-To-Repeat:
I just get is by the source code, so, sorry.
>Fix:
Add two new variables store the start address and the size of the last section, and update the esym by these two variables.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: port-i386-maintainer->jmmv
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Wed, 05 Mar 2008 10:15:27 +0000
Responsible-Changed-Why:
jmmv wrote the code and agreed to look at this.
State-Changed-From-To: open->closed
State-Changed-By: jmmv@NetBSD.org
State-Changed-When: Sat, 22 Mar 2008 16:51:44 +0000
State-Changed-Why:
As far as I can tell, the code was indeed correct. It is now fixed, thanks.
From: "Julio M. Merino Vidal" <jmmv@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/38170 CVS commit: src/sys/arch/i386/i386
Date: Sat, 22 Mar 2008 16:50:17 +0000 (UTC)
Module Name: src
Committed By: jmmv
Date: Sat Mar 22 16:50:17 UTC 2008
Modified Files:
src/sys/arch/i386/i386: multiboot.c
Log Message:
Fix esym calculation to match comments. Reported by Gao Ya'nan in
PR port-i386/38170.
To generate a diff of this commit:
cvs rdiff -r1.14 -r1.15 src/sys/arch/i386/i386/multiboot.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.