From owner-freebsd-bugs@freebsd.org Tue Jun 5 15:02:12 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20A3CFE9069 for ; Tue, 5 Jun 2018 15:02:12 +0000 (UTC) (envelope-from mqudsi@neosmart.net) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id ADA2C7D871 for ; Tue, 5 Jun 2018 15:02:11 +0000 (UTC) (envelope-from mqudsi@neosmart.net) Received: by mailman.ysv.freebsd.org (Postfix) id 69317FE9062; Tue, 5 Jun 2018 15:02:11 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 444E4FE905C for ; Tue, 5 Jun 2018 15:02:11 +0000 (UTC) (envelope-from mqudsi@neosmart.net) Received: from mail-oi0-x22d.google.com (mail-oi0-x22d.google.com [IPv6:2607:f8b0:4003:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB89F7D86A for ; Tue, 5 Jun 2018 15:02:10 +0000 (UTC) (envelope-from mqudsi@neosmart.net) Received: by mail-oi0-x22d.google.com with SMTP id a141-v6so2354257oii.8 for ; Tue, 05 Jun 2018 08:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neosmart.net; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yCEdJYry4Gc9l47i+Mcnwz7BdncEtnjVa41A0PX7b48=; b=xYmR7TKNA5YZr2TlRGpyiSGOsPI7focXj0+xi/HtQX+5MCMX6HfPm7JWNNzq1xGbGC 1rLVPN+uwDPUUpEhmOuRHtPOp8inBua0zxuvGWrjrAtHUqNBcshZiTTxedr3J3CT30j8 ZpCqR04bSejF0gXt7tvoXjO1yRAWT7N5SqeRs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yCEdJYry4Gc9l47i+Mcnwz7BdncEtnjVa41A0PX7b48=; b=lUVKvSbJKgHTl8a+mq1aHm8F4WcRZJAVq+tcn8sJmRup991SCDU0RRqYiogePHgaN7 7K0n5E7tSertU7tO+JF1rm8ugfsyS5kF8MAexaVsIBVry90anhUORlcwKEzefM//uOEO RzKbXyMURcWOh1g924e5FARGxG+8142L5NdcNvh4nRagSJXQChHMquhxe3DkGVcdRYlK TKXFDNySpZP5oWEhy29sEsL7kEkR+wQ+trRuYs90LNjLEycR/SarTclbJg6NmxJoeYtq 5ftv0UQwKNLj4UdZftYgvzbgXc16y1J0jDezpGhQs8mEoRVYSPaQ9exq9tnUrdAHsp+j hhpw== X-Gm-Message-State: APt69E0WNa+3XauPGIyt2AOMG0lhQEfFxF1qQbJwzcaR562rbkuYaug0 2rH8QHQJznwQfve+mtDuzigUMMpBqIHoMZUBtdfctw== X-Google-Smtp-Source: ADUXVKLAePg3rl3JXWvlftwcUwZMebys0pwgrWlY1RSaUV5lOR0nDywJvL19poys4oTxYqJ5+InPNW4whNStidMfTcQ= X-Received: by 2002:aca:dd83:: with SMTP id u125-v6mr2340452oig.39.1528210927190; Tue, 05 Jun 2018 08:02:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:e8f:0:0:0:0:0 with HTTP; Tue, 5 Jun 2018 08:01:46 -0700 (PDT) In-Reply-To: <20180605213242.K3458@besplex.bde.org> References: <20180605175705.Q2604@besplex.bde.org> <20180605213242.K3458@besplex.bde.org> From: Mahmoud Al-Qudsi Date: Tue, 5 Jun 2018 10:01:46 -0500 Message-ID: Subject: Re: [Bug 228755] libvgl under syscons causes system reboot (via SDL 1.2) To: Bruce Evans Cc: kib@freebsd.org, bugs@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2018 15:02:12 -0000 On Tue, Jun 5, 2018 at 7:32 AM, Bruce Evans wrote: > This is the driver getting the check wrong for all frame buffer sizes that > are not a multiple of PAGE_SIZE. The frame buffer size is not a multiple > of PAGE SIZE mainly for the interesting geometries 800x600x8 and > 1920x1080x8. I use this fix: > > Index: vesa.c > =================================================================== > --- vesa.c (revision 334595) > +++ vesa.c (working copy) > @@ -1642,7 +1642,7 @@ > (adp->va_info.vi_flags & V_INFO_LINEAR) != 0) { > /* va_window_size == va_buffer_size/vi_planes */ > /* XXX: is this correct? */ > - if (offset > adp->va_window_size - PAGE_SIZE) > + if (offset > trunc_page(adp->va_window_size)) > return (-1); > *paddr = adp->va_info.vi_buffer + offset; > #ifdef VM_MEMATTR_WRITE_COMBINING > > After fixing this, even 1920x1080x8 works. I submitted a (different) patch [0] that we've been using in production since 2014 for that particular code multiple times, most recently in January of 2018 [1]. It's not a libvgl-specific issue and honestly deserves to be fixed already. With it, we've been able to use sc as a pretty much bulletproof X target, with the caveat that it's insanely slow at higher (native) resolutions. This particular issue is actually already tracked in kern/162373, the same patch was submitted there by Mikhail Kupchik way back in November of 2011. Since you seem to know what you're doing - is the comparison with `trunc_page(adp->va_window_size)` here the way to go or the alternative approach with `offset >= adp->va_info.vi_buffer_size` range checking instead? Mahmoud Al-Qudsi NeoSmart Technologies [0]: https://github.com/neosmart/freebsd/commit/b3af2d1ed4a63fe1a5d771ed3a052242250098d7 [1]: http://freebsd.1045724.x6.nabble.com/PATCH-validated-against-50k-i686-machines-for-vmparam-h-and-vesa-c-td6235962.html