* [PATCH] video/logo: don't look for the logo after system boot
@ 2013-12-20 14:24 Sebastian Andrzej Siewior
2013-12-20 15:27 ` Geert Uytterhoeven
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-12-20 14:24 UTC (permalink / raw)
To: linux-fbdev
If the primary GPU driver has been loaded _after_ system as a module
then this logo memory is no longer valid.
Managed to crash the system by booting a box without a GPU and then
hotpluggin => BOOM.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/video/logo/logo.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
index 080c35b..a26bb16 100644
--- a/drivers/video/logo/logo.c
+++ b/drivers/video/logo/logo.c
@@ -36,6 +36,9 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
if (nologo)
return NULL;
+ if (system_state != SYSTEM_BOOTING)
+ return NULL;
+
if (depth >= 1) {
#ifdef CONFIG_LOGO_LINUX_MONO
/* Generic Linux logo */
--
1.8.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] video/logo: don't look for the logo after system boot
2013-12-20 14:24 [PATCH] video/logo: don't look for the logo after system boot Sebastian Andrzej Siewior
@ 2013-12-20 15:27 ` Geert Uytterhoeven
2013-12-20 15:31 ` Sebastian Andrzej Siewior
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2013-12-20 15:27 UTC (permalink / raw)
To: linux-fbdev
On Fri, Dec 20, 2013 at 3:24 PM, Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
> If the primary GPU driver has been loaded _after_ system as a module
> then this logo memory is no longer valid.
> Managed to crash the system by booting a box without a GPU and then
> hotpluggin => BOOM.
Which GPU driver is this?
drivers/video/fbmem.c:fb_prepare_logo() has protection against this:
if (info->flags & FBINFO_MISC_TILEBLITTING ||
info->flags & FBINFO_MODULE)
return 0;
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/video/logo/logo.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
> index 080c35b..a26bb16 100644
> --- a/drivers/video/logo/logo.c
> +++ b/drivers/video/logo/logo.c
> @@ -36,6 +36,9 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
> if (nologo)
> return NULL;
>
> + if (system_state != SYSTEM_BOOTING)
> + return NULL;
> +
> if (depth >= 1) {
> #ifdef CONFIG_LOGO_LINUX_MONO
> /* Generic Linux logo */
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] video/logo: don't look for the logo after system boot
2013-12-20 14:24 [PATCH] video/logo: don't look for the logo after system boot Sebastian Andrzej Siewior
2013-12-20 15:27 ` Geert Uytterhoeven
@ 2013-12-20 15:31 ` Sebastian Andrzej Siewior
2013-12-20 15:49 ` Sebastian Andrzej Siewior
2013-12-20 16:20 ` Geert Uytterhoeven
3 siblings, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-12-20 15:31 UTC (permalink / raw)
To: linux-fbdev
On 12/20/2013 04:27 PM, Geert Uytterhoeven wrote:
> On Fri, Dec 20, 2013 at 3:24 PM, Sebastian Andrzej Siewior
> <bigeasy@linutronix.de> wrote:
>> If the primary GPU driver has been loaded _after_ system as a module
>> then this logo memory is no longer valid.
>> Managed to crash the system by booting a box without a GPU and then
>> hotpluggin => BOOM.
>
> Which GPU driver is this?
i915.
>
> drivers/video/fbmem.c:fb_prepare_logo() has protection against this:
>
> if (info->flags & FBINFO_MISC_TILEBLITTING ||
> info->flags & FBINFO_MODULE)
> return 0;
but gpu driver is built-in. I just add PCI device at run-time. The same
thing should happen if you go to sysfs and remove the PCI device and
then do
echo 1 > /sys/bus/pci/rescan
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] video/logo: don't look for the logo after system boot
2013-12-20 14:24 [PATCH] video/logo: don't look for the logo after system boot Sebastian Andrzej Siewior
2013-12-20 15:27 ` Geert Uytterhoeven
2013-12-20 15:31 ` Sebastian Andrzej Siewior
@ 2013-12-20 15:49 ` Sebastian Andrzej Siewior
2013-12-20 16:20 ` Geert Uytterhoeven
3 siblings, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-12-20 15:49 UTC (permalink / raw)
To: linux-fbdev
On 12/20/2013 04:31 PM, Sebastian Andrzej Siewior wrote:
> On 12/20/2013 04:27 PM, Geert Uytterhoeven wrote:
>> On Fri, Dec 20, 2013 at 3:24 PM, Sebastian Andrzej Siewior
>> <bigeasy@linutronix.de> wrote:
>>> If the primary GPU driver has been loaded _after_ system as a module
>>> then this logo memory is no longer valid.
>>> Managed to crash the system by booting a box without a GPU and then
>>> hotpluggin => BOOM.
>>
>> drivers/video/fbmem.c:fb_prepare_logo() has protection against this:
>>
>> if (info->flags & FBINFO_MISC_TILEBLITTING ||
>> info->flags & FBINFO_MODULE)
>> return 0;
>
> but gpu driver is built-in. I just add PCI device at run-time. The same
> thing should happen if you go to sysfs and remove the PCI device and
> then do
No I see where you are going with this. My description of the problem
is wrong. The problem is nothing to do with the driver being a module.
If nobody objects this or suggests a different solution then I'm going
to provide a patch with a proper description.
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] video/logo: don't look for the logo after system boot
2013-12-20 14:24 [PATCH] video/logo: don't look for the logo after system boot Sebastian Andrzej Siewior
` (2 preceding siblings ...)
2013-12-20 15:49 ` Sebastian Andrzej Siewior
@ 2013-12-20 16:20 ` Geert Uytterhoeven
3 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2013-12-20 16:20 UTC (permalink / raw)
To: linux-fbdev
On Fri, Dec 20, 2013 at 4:49 PM, Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
> On 12/20/2013 04:31 PM, Sebastian Andrzej Siewior wrote:
>> On 12/20/2013 04:27 PM, Geert Uytterhoeven wrote:
>>> On Fri, Dec 20, 2013 at 3:24 PM, Sebastian Andrzej Siewior
>>> <bigeasy@linutronix.de> wrote:
>>>> If the primary GPU driver has been loaded _after_ system as a module
>>>> then this logo memory is no longer valid.
>>>> Managed to crash the system by booting a box without a GPU and then
>>>> hotpluggin => BOOM.
>>>
>>> drivers/video/fbmem.c:fb_prepare_logo() has protection against this:
>>>
>>> if (info->flags & FBINFO_MISC_TILEBLITTING ||
>>> info->flags & FBINFO_MODULE)
>>> return 0;
>>
>> but gpu driver is built-in. I just add PCI device at run-time. The same
>> thing should happen if you go to sysfs and remove the PCI device and
>> then do
>
> No I see where you are going with this. My description of the problem
> is wrong. The problem is nothing to do with the driver being a module.
Yes, I got confused by the "as a module".
> If nobody objects this or suggests a different solution then I'm going
> to provide a patch with a proper description.
Is "system_state != SYSTEM_BOOTING" the right check?
How long is is in the SYSTEM_BOOTING state?
Ah, kernel_init() does:
free_initmem();
mark_rodata_ro();
system_state = SYSTEM_RUNNING;
So this looks OK to me.
We used to have an initmem_freed flag, but it was removed 15 years
ago. 11 years ago, we got system_state, for the same purpose ;-)
Looking at commit 70802c60379fb843c485dfd4cab9e8f527d8fe81
Author: Antonino A. Daplas <adaplas@gmail.com>
Date: Tue May 8 00:38:14 2007 -0700
fbdev: don't show logo if driver or fbcon are modular
it seems we were not aware of the existence of system_state....
I guess you can remove FBINFO_MODULE after your fix?
BTW, I'm wondering if modprobing newport_con.ko crashes, too, as
it seems to call fb_find_logo() without any protection.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-20 16:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 14:24 [PATCH] video/logo: don't look for the logo after system boot Sebastian Andrzej Siewior
2013-12-20 15:27 ` Geert Uytterhoeven
2013-12-20 15:31 ` Sebastian Andrzej Siewior
2013-12-20 15:49 ` Sebastian Andrzej Siewior
2013-12-20 16:20 ` Geert Uytterhoeven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.