NetBSD Problem Report #41401

From jakllsch@ifni.kollasch.net  Sun May 10 14:17:29 2009
Return-Path: <jakllsch@ifni.kollasch.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 7C82063C1B7
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 10 May 2009 14:17:29 +0000 (UTC)
Message-Id: <20090510141726.018F0573CA@ifni.kollasch.net>
Date: Sun, 10 May 2009 14:17:25 +0000 (UTC)
From: jakllsch@kollasch.net
Reply-To: jakllsch@kollasch.net
To: gnats-bugs@gnats.NetBSD.org
Subject: pthreaded apps crash i386/xen kernel
X-Send-Pr-Version: 3.95

>Number:         41401
>Category:       port-xen
>Synopsis:       pthreaded apps crash i386/xen kernel
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bouyer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 10 14:20:01 +0000 2009
>Closed-Date:    Thu May 21 17:02:44 +0000 2009
>Last-Modified:  Thu May 21 17:02:44 +0000 2009
>Originator:     Jonathan A. Kollasch
>Release:        NetBSD 5.99.11 20090509
>Organization:

>Environment:
Architecture: i386
Machine: i386
>Description:

x86_set_sdbase() tries to directly write to the GDT, which isn't directly accesible in the xen case.

dhcpcd - - - xennet0: leased 172.27.42.245 for 86400 seconds
uvm_fault(0xc03e21c0, 0xc4a57000, 2) -> 0xe
fatal page fault in supervisor mode
trap type 6 code 3 eip c02aee73 cs 9 eflags 10282 cr2 c4a570b0 ilevel 0
kernel: supervisor trap page fault, code=0
Stopped in pid 348.1 (dig) at   netbsd:x86_set_sdbase+0xb7:     movl    %edx,0(%eax)
db> bt
x86_set_sdbase(bfa00000,67,c57db820,1,0,1000,c591dcdc,c02aeab4,c57db820,bfa00000) at netbsd:x86_set_sdbase+0xb7
cpu_lwp_setprivate(c57db820,bfa00000,c57cb598,0,c03a8c98,c57db820,c591dd3c,c02b6115,c57db820,c591dd00) at netbsd:cpu_lwp_setprivate+0x15
sys__lwp_setprivate(c57db820,c591dd00,c591dd28,c591dd00,bfa00000,c57cb598,13d,bfa00000,1c,bfbfeb90) at netbsd:sys__lwp_setprivate+0x1c
syscall(c591dd48,1f,1f,1f,1f,1c,bfa00000,bfbfeb90,bba5b24c,0) at netbsd:syscall+0xf5
db>

the failing line is sys/arch/x86/x86/sys_machdep.c:1.18:628.

>How-To-Repeat:
boot a i386 XEN3 kernel, run dig, or try to build perl

>Fix:
maybe not try to modify the gdt on xen?

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-xen-maintainer->bouyer
Responsible-Changed-By: bouyer@NetBSD.org
Responsible-Changed-When: Sun, 17 May 2009 18:25:49 +0000
Responsible-Changed-Why:
I commited a fix


State-Changed-From-To: open->feedback
State-Changed-By: bouyer@NetBSD.org
State-Changed-When: Sun, 17 May 2009 18:25:49 +0000
State-Changed-Why:
Hi,
please try a kernel wil x86/x86/sys_machdep.c rev 1.19


From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41401 CVS commit: src/sys/arch
Date: Sun, 17 May 2009 18:24:24 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun May 17 18:24:24 UTC 2009

 Modified Files:
 	src/sys/arch/i386/i386: gdt.c
 	src/sys/arch/i386/include: segments.h
 	src/sys/arch/x86/x86: sys_machdep.c

 Log Message:
 on Xen the GDT has to be updated though HYPERVISOR_update_descriptor().
 Export i386/i386/gdt.c:update_descriptor() and use it in x86_set_sdbase(),
 as a direct write to the GDT will cause a kernel trap.
 Fix PR port-xen/41401.


 To generate a diff of this commit:
 cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/i386/gdt.c
 cvs rdiff -u -r1.52 -r1.53 src/sys/arch/i386/include/segments.h
 cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/x86/sys_machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-xen/41401 (pthreaded apps crash i386/xen kernel)
Date: Thu, 21 May 2009 14:39:12 +0000

 Testing with these changes shows they do not exhibit the reported problem.

State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 21 May 2009 17:02:44 +0000
State-Changed-Why:
Confirmed fixed; thanks for testing


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.