NetBSD Problem Report #54767
From elo@foobox.net Sat Dec 14 21:41:29 2019
Return-Path: <elo@foobox.net>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id D166F7A174
for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Dec 2019 21:41:29 +0000 (UTC)
Message-Id: <20191214214125.86DF1821F@marmite.localnet>
Date: Sat, 14 Dec 2019 21:41:25 +0000 (GMT)
From: elo@foobox.net
Reply-To: elo@foobox.net
To: gnats-bugs@NetBSD.org
Subject: Wrong mask constant in VESA BIOS Extensions code
X-Send-Pr-Version: 3.95
>Number: 54767
>Category: kern
>Synopsis: Wrong mask constant in VESA BIOS Extensions code
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Dec 14 21:45:00 +0000 2019
>Closed-Date: Sun Dec 15 10:09:23 +0000 2019
>Last-Modified: Sun Dec 15 10:09:23 +0000 2019
>Originator: elo
>Release: NetBSD 9.0_BETA
>Organization:
>Environment:
System: NetBSD marmite.localnet 9.0_BETA NetBSD 9.0_BETA (BLUEBELL) #3: Sun Nov 3 02:10:56 GMT 2019 elo@marmite.localnet:/usr/obj/sys/arch/amd64/compile/BLUEBELL amd64
Architecture: x86_64
Machine: amd64
>Description:
In the file 'src/sys/arch/i386/stand/lib/vbe.c' is a mask
constant with transposed digits. According to the 'VESA BIOS
EXTENSION (VBE) Core Functions Standard, Version 3.0', dated
16 September 1998, found at
http://www.petesqbsite.com/sections/tutorials/tuts/vbe3.pdf,
in the ModeAttributes field of the ModeInfoBlock structure for
VBE Function 01h (see page 32), it is bit 7 that indicates
whether linear frame-buffer mode is available, but because
the mask is wrong (0x08 instead of 0x80), it is in fact the
graphics/text-mode flag being tested.
>How-To-Repeat:
The error was found by code inspection. To my knowledge, it
has never caused a problem in practice.
>Fix:
Apply the following patch.
--- a/usr/src/sys/arch/i386/stand/lib/vbe.c 2019-08-21 04:14:10.759601198 +0100
+++ b/usr/src/sys/arch/i386/stand/lib/vbe.c 2019-08-21 04:14:10.800315268 +0100
@@ -50,7 +50,7 @@
{
if ((mi->ModeAttributes & 0x01) == 0)
return 0; /* mode not supported by hardware */
- if ((mi->ModeAttributes & 0x08) == 0)
+ if ((mi->ModeAttributes & 0x80) == 0)
return 0; /* linear fb not available */
if ((mi->ModeAttributes & 0x10) == 0)
return 0; /* text mode */
>Release-Note:
>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/54767: Wrong mask constant in VESA BIOS Extensions code
Date: Sun, 15 Dec 2019 01:12:14 -0000 (UTC)
elo@foobox.net writes:
> in the ModeAttributes field of the ModeInfoBlock structure for
> VBE Function 01h (see page 32), it is bit 7 that indicates
> whether linear frame-buffer mode is available, but because
> the mask is wrong (0x08 instead of 0x80), it is in fact the
> graphics/text-mode flag being tested.
0x08 is a test for color mode, ruling out monochrome modes. I would
guess that there is no support for that, and we are actually missing
two lines like:
Index: vbe.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/vbe.c,v
retrieving revision 1.9
diff -p -u -r1.9 vbe.c
--- vbe.c 24 Jan 2017 11:09:14 -0000 1.9
+++ vbe.c 15 Dec 2019 01:10:26 -0000
@@ -51,6 +51,8 @@ vbe_mode_is_supported(struct modeinfoblo
if ((mi->ModeAttributes & 0x01) == 0)
return 0; /* mode not supported by hardware */
if ((mi->ModeAttributes & 0x08) == 0)
+ return 0; /* only color modes are supported */
+ if ((mi->ModeAttributes & 0x80) == 0)
return 0; /* linear fb not available */
if ((mi->ModeAttributes & 0x10) == 0)
return 0; /* text mode */
--
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54767 CVS commit: src/sys/arch/i386/stand/lib
Date: Sat, 14 Dec 2019 22:38:18 -0500
Module Name: src
Committed By: christos
Date: Sun Dec 15 03:38:17 UTC 2019
Modified Files:
src/sys/arch/i386/stand/lib: vbe.c
Log Message:
PR/54767: elo: fix incorrect test (mlelstv)
Add symbolic constants and reference to the standard.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/lib/vbe.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 15 Dec 2019 10:09:23 +0000
State-Changed-Why:
Fixed by mlelstv & christos. Thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.