From nobody@FreeBSD.org  Wed Feb 16 09:45:03 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7DA6A16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 16 Feb 2005 09:45:03 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 60F8343D2F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 16 Feb 2005 09:45:03 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j1G9j3Hh089127
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 16 Feb 2005 09:45:03 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j1G9j2xZ089124;
	Wed, 16 Feb 2005 09:45:02 GMT
	(envelope-from nobody)
Message-Id: <200502160945.j1G9j2xZ089124@www.freebsd.org>
Date: Wed, 16 Feb 2005 09:45:02 GMT
From: Christian Kandeler <christian.kandeler@hob.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Case of pointer to FPSWA being NULL not correctly handled
X-Send-Pr-Version: www-2.3

>Number:         77591
>Category:       ia64
>Synopsis:       Case of pointer to FPSWA being NULL not correctly handled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ia64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 16 09:50:10 GMT 2005
>Closed-Date:    Wed Mar 02 20:29:51 GMT 2005
>Last-Modified:  Wed Mar 02 20:29:51 GMT 2005
>Originator:     Christian Kandeler
>Release:        5.3
>Organization:
HOB
>Environment:
n/a (cannot boot)
>Description:
In sys/ia64/ia64/machdep.c, the physical address of the fpswa interface in the boot_info structure is unconditionally converted to a virtual address: 
  fpswa_interface = (FPSWA_INTERFACE*)IA64_PHYS_TO_RR7(bootinfo.bi_fpswa);
This will lead to invalid memory accesses if the original physical address was zero, causing the machine to crash very early in the boot process.
>How-To-Repeat:
Boot on a machine with no FPSWA built into the firmware.
>Fix:
Here is a patch. I know this web form should not be used to submit code, but since I'm not able to boot into the system, I cannot use the send-pr program.

--- sys/ia64/ia64/machdep.c	2004-09-09 10:03:19.000000000 +0000
+++ sys/ia64/ia64/machdep.c	2005-02-16 09:16:19.335945801 +0000
@@ -600,7 +600,8 @@
               printf("WARNING: loader(8) metadata is missing!\n");
 
         /* Get FPSWA interface */
-        fpswa_interface = (FPSWA_INTERFACE*)IA64_PHYS_TO_RR7(bootinfo.bi_fpswa);
+        fpswa_interface = (bootinfo.bi_fpswa != NULL) ?
+            (FPSWA_INTERFACE*) IA64_PHYS_TO_RR7(bootinfo.bi_fpswa) : NULL;
 
         /* Init basic tunables, including hz */
         init_param1();

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: marcel 
State-Changed-When: Wed Mar 2 20:29:18 GMT 2005 
State-Changed-Why:  
Committed to current. Will be MFC'd for 5.4-RELEASE. 
Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77591 
>Unformatted:
