From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Aug 31 06:53:15 2014 Return-Path: Delivered-To: freebsd-ports-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 37ECB3ED for ; Sun, 31 Aug 2014 06:53:15 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 183B31F93 for ; Sun, 31 Aug 2014 06:53:15 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id s7V6rE7f007009 for ; Sun, 31 Aug 2014 06:53:14 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 193192] New: vt keymaps with Unicode characters crash X server on start Date: Sun, 31 Aug 2014 06:53:15 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports Tree X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: se@FreeBSD.org X-Bugzilla-Status: Needs Triage X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-ports-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2014 06:53:15 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193192 Bug ID: 193192 Summary: vt keymaps with Unicode characters crash X server on start Product: Ports Tree Version: Latest Hardware: Any OS: Any Status: Needs Triage Severity: Affects Many People Priority: Normal Component: Individual Port(s) Assignee: freebsd-ports-bugs@FreeBSD.org Reporter: se@FreeBSD.org The problem is an assumption, that does not hold if the new console driver (vt) is used. In x11-drivers/xf86-input-keyboard line 1264ff of bsd_KeyMap.c, an assumption is made, that the character returned will be in the range of 0x00 to 0xff. #define KD_GET_ENTRY(i,n) \ eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] [...] void KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) { KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; KeySym *k; int i; #ifndef __bsdi__ switch (pKbd->consType) { /* * XXX wscons has no GIO_KEYMAP */ #if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP) case SYSCONS: case PCVT: { keymap_t keymap; if (ioctl(pInfo->fd, GIO_KEYMAP, &keymap) != -1) { for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) if (remap[i]) { k = map + (remap[i] << 2); k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ k[1] = KD_GET_ENTRY(i,1); /* shifted */ k[2] = KD_GET_ENTRY(i,4); /* alt */ k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ if (k[3] == k[2]) k[3] = NoSymbol; if (k[2] == k[1]) k[2] = NoSymbol; if (k[1] == k[0]) k[1] = NoSymbol; if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol; } } } break; #endif /* SYSCONS || PCVT */ The keymap returned by ioctl(GIO_KEYMAP) used to contain characters in the selected locale, which meant it was limited to 8 bit values, effectively. Now with Unicode support, larger values (>=0x100) can be found in keymap files. In my case, the Euro symbol (0x20ac) was the cause of an out-of-bounds access to the keymap array in line 1265 of bsd_KbdMap.c (assignment to k[2] for Alt "E"). To reproduce, you need to use the "vt" console driver: Load any keyboard with Unicode characters beyond 0x100 with kbdcontrol (e.g. kbdcontrol -l de). Then start Xorg and see that it crashes with a segfault when trying to load the keymap. -- You are receiving this mail because: You are the assignee for the bug.