From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 18 19:20:22 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D94C16A41C for ; Mon, 18 Jul 2005 19:20:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CC4E143D49 for ; Mon, 18 Jul 2005 19:20:21 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j6IJKLpj069200 for ; Mon, 18 Jul 2005 19:20:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j6IJKLEZ069198; Mon, 18 Jul 2005 19:20:21 GMT (envelope-from gnats) Resent-Date: Mon, 18 Jul 2005 19:20:21 GMT Resent-Message-Id: <200507181920.j6IJKLEZ069198@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Harry Coin Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1E5C116A41C for ; Mon, 18 Jul 2005 19:14:40 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3D4743D46 for ; Mon, 18 Jul 2005 19:14:39 +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 j6IJEdMJ023199 for ; Mon, 18 Jul 2005 19:14:39 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j6IJEdfQ023198; Mon, 18 Jul 2005 19:14:39 GMT (envelope-from nobody) Message-Id: <200507181914.j6IJEdfQ023198@www.freebsd.org> Date: Mon, 18 Jul 2005 19:14:39 GMT From: Harry Coin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: kern/83686: kernel resource_xxx_value hints fails to find dynamic environment changes X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2005 19:20:22 -0000 >Number: 83686 >Category: kern >Synopsis: kernel resource_xxx_value hints fails to find dynamic environment changes >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 18 19:20:21 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Harry Coin >Release: 5.4 >Organization: >Environment: FreeBSD sueofficerm 5.4-RELEASE FreeBSD 5.4-RELEASE #23: Mon Jul 18 13:34:01 CDT 2005 root@server1.quietfountain.com:/usr/obj/usr/src/sys/DISKLESS i386 >Description: The resource_xxx routines in subr_hints.c are called before and after the kenv environment in kern_environment.c switches to dynamic. The prior call sets static variable hintp to the static hints in subr_hints.c. (hintmode==0). However, changes to the environment are not detected by the resource_xxx lookups after the change to dynamic kernel environment, so the lookup routines only report the old stuff in hintmode 0, even after the change to dynamic. Upshot: kenv users see one thing, the kernel routines depending on the same information use a hidden prior kernel environment roster. When hintmode==0 (usual case), checks in res_find (called by all resource_xxx lookups) fail to note to switch to dynamic kenv because static hintp isn't reset at the top of the routine that checks for the switch to dynamic. Hence no switch and lookup failure problems. This is a problem in the mixer.c code that looks up initial mixer volume settings from the hints. If the hints are dynamic and not from the device.hints file, mixer.c doesn't see them -- but kenv does. tested confirmed bugfix below. >How-To-Repeat: Add anything via kernel call setenv in kern_environment.c after dynamic has been initialized. Try using the resource_xxx routines in subr_hints.c to find the new item. It won't be there as the lookup routine fails to note the change from static to dynamic hints. kenv dump and related routines find them. tested confirmed bugfix below. >Fix: --- /usr/src/sys/kern/subr_hints.c Sun Mar 13 12:05:26 2005 +++ /mnt/server1/usr/src/sys/kern/subr_hints.c Mon Jul 18 13:53:02 2005 @@ -61,6 +61,7 @@ char *p; if (checkmethod) { + hintp=NULL; switch (hintmode) { case 0: /* loader hints in environment only */ break; >Release-Note: >Audit-Trail: >Unformatted: