From owner-svn-src-all@freebsd.org Tue Jul 26 15:34:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E825ABA5AF2; Tue, 26 Jul 2016 15:34:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B79C51192; Tue, 26 Jul 2016 15:34:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6QFYQ5K017046; Tue, 26 Jul 2016 15:34:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6QFYQ9L017045; Tue, 26 Jul 2016 15:34:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607261534.u6QFYQ9L017045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 26 Jul 2016 15:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303338 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2016 15:34:28 -0000 Author: emaste Date: Tue Jul 26 15:34:26 2016 New Revision: 303338 URL: https://svnweb.freebsd.org/changeset/base/303338 Log: vt: lock Giant around kbd calls in CONS_GETINFO Note that keyboards are stored in an array and are not freed (just "unregistered" by clearing some fields) so a race would be limited to obtaining stale information about an unregistered keyboard. Reported by: CTurt MFC after: 3 days Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Tue Jul 26 15:22:21 2016 (r303337) +++ head/sys/dev/vt/vt_core.c Tue Jul 26 15:34:26 2016 (r303338) @@ -2228,9 +2228,11 @@ skip_thunk: return (EINVAL); if (vw == vd->vd_curwindow) { + mtx_lock(&Giant); kbd = kbd_get_keyboard(vd->vd_keyboard); if (kbd != NULL) vt_save_kbd_state(vw, kbd); + mtx_unlock(&Giant); } vi->m_num = vd->vd_curwindow->vw_number + 1;