From owner-p4-projects@FreeBSD.ORG Wed Jul 26 13:59:08 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F3CD416A4E2; Wed, 26 Jul 2006 13:59:07 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B6FA716A4DF for ; Wed, 26 Jul 2006 13:59:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7F79443D46 for ; Wed, 26 Jul 2006 13:59:07 +0000 (GMT) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6QDx7xR022652 for ; Wed, 26 Jul 2006 13:59:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6QDx7dL022649 for perforce@freebsd.org; Wed, 26 Jul 2006 13:59:07 GMT (envelope-from hselasky@FreeBSD.org) Date: Wed, 26 Jul 2006 13:59:07 GMT Message-Id: <200607261359.k6QDx7dL022649@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 102456 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2006 13:59:08 -0000 http://perforce.freebsd.org/chv.cgi?CH=102456 Change 102456 by hselasky@hselasky_mini_itx on 2006/07/26 13:58:20 There is a big problem in the keyboard system: If scroll lock is pressed and "printf()" is called, the Giant lock must be acquired by "printf()" before un-scroll-locking the keyboard by an IOCTL call. Hence that will cause a locking reversal problem, I see no other solution than to disable the IOCTL call, leaving the keyboard scroll-locked. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/ukbd.c#7 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/ukbd.c#7 (text+ko) ==== @@ -1162,6 +1162,21 @@ struct ukbd_softc *sc = kbd->kb_data; int i; + if (!mtx_owned(&Giant)) { + /* XXX big problem: + * If scroll lock is pressed and + * "printf()" is called, the CPU will + * get here, to un-scroll lock the + * keyboard. But if "printf()" acquires + * the "Giant" lock, there will be a + * locking order reversal problem, + * so the keyboard system must get + * out of "Giant" first, before + * the CPU can proceed here ... + */ + return EINVAL; + } + mtx_assert(&Giant, MA_OWNED); switch (cmd) {