[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] efifb: ignore frame buffer with physical address 0


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 18 Nov 2022 14:44:28 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lNlMLUQguxBjhgQ7a2qDcoPA+nYF/Bgs2inTOGLNjMI=; b=BEpALoVrg10EKqpURrwCMdzaEXuYLVqTrpnLw5Ks/sz5sknZV9COFz5dxVkeZfgvuDOUfjinuYEZuzd6dosejTIYJvHz7XmCZTZ7QCPB2kjyqmXSilY15xhPOn4BSqze3yp3cHrmVM7Wm3HO7eGP5+iaDhKQ4QN1BTrdrCsv29dh6jl5alEbcvT5lI18MVU2zsnoIlFQ1OBRQyKgn+ZX3KGAT7KuYHWHRQiRfP9am5AyJPktxsWu+sCa8vEZEOBvkQBDX00IWjaB1yyAhqkWvIwv5vuY/dKnxAmFzMHUKSOdnrHDRuEMNk/GflvhieRxn90pVDfOlKOdC8oVLfZaJg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=auIbv0PjFVDoL9tmAdY7EZfBNDKL3aBJREThSK6Xf8JxgHxr3Uc7o+H/K6CFF04pTqT6K1fVzoPUEZIHdG87t6w3rLPAWs/GZDcosfr9z1OFu9JFbLHGHsiVidvkf338t8h+WGTzHPZ9Lu5dbq02Y+ZiNb0oNmaK9XyNmWud8pTf3e7LGR4/Ic8uCvt6XLyyWUVHnDiXOHAS8LUk0a1GcKOLRTDR7mF6+yM18I4x8O1X3rj0BQwjmv3F9VQtVuEO3DkzmjeScMJkPNe1eSQiC3awSu3rwcdxUKW7Sud9cxS/erK2MhQr2ifAhboQhiY5JL9wmcPtHtUfprrV+n1wkw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 18 Nov 2022 13:44:56 +0000
  • Ironport-data: A9a23:OxEwmqPjZlnSm/rvrR2BlsFynXyQoLVcMsEvi/4bfWQNrUomhTFSy mQbXG2HMvreMWTyctF3PYni8klQuMTQmNU1Hgto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQA+KmU4YoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvzrRC9H5qyo4mpB5wxmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0v1oImVh+ 6UfERcmRU26jaG64vHnasA506zPLOGzVG8ekldJ6GmDSNwAGNXESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+PNxvzG7IA9ZidABNPLPfdOHX4NNl1uwr WPa5WXpRBodMbRzzBLVryv33bWTx0sXXqoUNLy42vc1qWbCw0koETERdnSnkaGm3xvWt9V3b hZ8FjAVhao4+VGvT9L9dwalu3PCtRkZM/JPF8Uq5QfLzbDbiy6JC25BQjNfZdgOsM4tWSdsx lKPh8nuBzFkrPuSU331y1uPhTa7OCxQJ2lbYyYBFVEB+4O7/Nh1iQ/TRNF+FqLzlsfyBTz73 zGNqm45mqkXiskIka68+Dgrng6Rm3QAdSZtji2/Y45vxloRiFKND2Bw1WXm0A==
  • Ironport-hdrordr: A9a23:S1KuParv9DIMgmOJf0lc5Z0aV5opeYIsimQD101hICG9E/bo9P xG88566faZslwssRIb6LK90cC7KBu2yXcS2+Qs1NyZMDUO1lHIEKhSqa7j2SDdASHk1uM178 ldWpk7LNXxCFh8g+b2iTPWL+od
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Nov 18, 2022 at 02:04:40PM +0100, Jan Beulich wrote:
> On 18.11.2022 13:39, Roger Pau Monne wrote:
> > On one of my boxes when the HDMI cable is not plugged in the
> > FrameBufferBase of the EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE structure is
> > set to 0 by the firmware (while some of the other fields looking
> > plausible).
> > 
> > Such (bogus address) ends up mapped in vesa_init(), and since it
> > overlaps with a RAM region the whole system goes down pretty badly,
> > see:
> > 
> > (XEN) vesafb: framebuffer at 0x0000000000000000, mapped to 
> > 0xffff82c000201000, using 35209k, total 35209k
> > (XEN) vesafb: mode is 0x37557x32, linelength=960, font 8x16
> 
> Interesting mode - should we check for non-zero values there as well,
> perhaps?

We could, yes, I went for what Linux currently does, but a height or
width of 0 is also likely wrong. We already check for bpp != 0.

> > (XEN) vesafb: Truecolor: size=8:8:8:8, shift=24:0:8:16
> > (XEN) (XEN) (XEN) (XEN) (XEN) (XEN) (XEN) (XEN) �ERROR: Class:0; 
> > Subclass:0; Operation: 0
> > ERROR: No ConOut
> > ERROR: No ConIn
> > 
> > Do like Linux and prevent using the EFI Frame Buffer if the base
> > address is 0.  This is inline with the logic in Linuxes
> > fb_base_is_valid() function at drivers/video/fbdev/efifb.c v6.0.9.
> > 
> > See also Linux commit 133bb070e94ab41d750c6f2160c8843e46f11b78 for
> > further reference.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> > ---
> > Other options would be doing the check in vesa_init(), but that would
> > also then apply to other framebuffers and won't be strictly limited to
> > the EFI fb.
> 
> Well, zero is wrong uniformly, so it wouldn't seem unreasonable to
> put the check there. But I'm happy to keep it in EFI code for now.
> 
> > We could also check in vesa_init() whether the framebuffer overlaps
> > with any RAM region, but I think that should be in addition to the
> > change done here.
> 
> Indeed.
> 
> > --- a/xen/arch/x86/efi/efi-boot.h
> > +++ b/xen/arch/x86/efi/efi-boot.h
> > @@ -552,7 +552,7 @@ static void __init 
> > efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
> >          bpp  = 0;
> >          break;
> >      }
> > -    if ( bpp > 0 )
> > +    if ( bpp > 0 && gop->Mode->FrameBufferBase )
> >      {
> >          vga_console_info.video_type = XEN_VGATYPE_EFI_LFB;
> >          vga_console_info.u.vesa_lfb.gbl_caps = 2; /* possibly non-VGA */
> 
> A few lines up from here, just out of patch context, there is a
> PrintErr() which imo is bogus/misleading when also encountering a
> zero fb base. I'd like to suggest that you put the new check early
> in the function (perhaps extended by a zero check of other
> applicable fields, as per above), returning right away alongside
> another new PrintErr().

Would you be fine with the new message being "Invalid Frame Buffer
configuration found"?

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.