lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALUcmUn30tPxjToysLBVBmibMaQUWW=GqFoqduP-W5QwQ-VriQ@mail.gmail.com>
Date: Tue, 10 Sep 2024 14:18:35 +0200
From: Arthur Borsboom <arthurborsboom@...il.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Roger Pau Monné <roger.pau@...rix.com>, 
	Thomas Zimmermann <tzimmermann@...e.de>, Jason Andryuk <jandryuk@...il.com>, Helge Deller <deller@....de>, 
	Arnd Bergmann <arnd@...db.de>, Sam Ravnborg <sam@...nborg.org>, xen-devel@...ts.xenproject.org, 
	Jason Andryuk <jason.andryuk@....com>, stable@...r.kernel.org, linux-fbdev@...r.kernel.org, 
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fbdev/xen-fbfront: Assign fb_info->device

On Tue, 10 Sept 2024 at 10:33, Greg KH <gregkh@...uxfoundation.org> wrote:
>
> On Tue, Sep 10, 2024 at 10:13:01AM +0200, Roger Pau Monné wrote:
> > On Tue, Sep 10, 2024 at 09:29:30AM +0200, Thomas Zimmermann wrote:
> > > Hi
> > >
> > > Am 10.09.24 um 09:22 schrieb Roger Pau Monné:
> > > > On Mon, Sep 09, 2024 at 10:09:16PM -0400, Jason Andryuk wrote:
> > > > > From: Jason Andryuk <jason.andryuk@....com>
> > > > >
> > > > > Probing xen-fbfront faults in video_is_primary_device().  The passed-in
> > > > > struct device is NULL since xen-fbfront doesn't assign it and the
> > > > > memory is kzalloc()-ed.  Assign fb_info->device to avoid this.
> > > > >
> > > > > This was exposed by the conversion of fb_is_primary_device() to
> > > > > video_is_primary_device() which dropped a NULL check for struct device.
> > > > >
> > > > > Fixes: f178e96de7f0 ("arch: Remove struct fb_info from video helpers")
> > > > > Reported-by: Arthur Borsboom <arthurborsboom@...il.com>
> > > > > Closes: https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/
> > > > > Tested-by: Arthur Borsboom <arthurborsboom@...il.com>
> > > > > CC: stable@...r.kernel.org
> > > > > Signed-off-by: Jason Andryuk <jason.andryuk@....com>
> > > > Reviewed-by: Roger Pau Monné <roger.pau@...rix.com>
> > > >
> > > > > ---
> > > > > The other option would be to re-instate the NULL check in
> > > > > video_is_primary_device()
> > > > I do think this is needed, or at least an explanation.  The commit
> > > > message in f178e96de7f0 doesn't mention anything about
> > > > video_is_primary_device() not allowing being passed a NULL device
> > > > (like it was possible with fb_is_primary_device()).
> > > >
> > > > Otherwise callers of video_is_primary_device() would need to be
> > > > adjusted to check for device != NULL.
> > >
> > > The helper expects a non-NULL pointer. We might want to document this.
> >
> > A BUG_ON(!dev); might be enough documentation that the function
> > expected a non-NULL dev IMO.
>
> No need for that, don't check for things that will never happen.

And yet, here we are, me reporting a kernel/VM crash due to a thing
that will never happen, see 'Closes' above.

I don't want to suggest BUG_ON is the right approach; I have no idea.
I just want to mention that (!dev) did happen. :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ