All of lore.kernel.org
 help / color / mirror / Atom feed
* UBSAN: shift-out-of-bounds in fbcon_set_font
@ 2023-01-25 23:58 ` Sanan Hasanov
  0 siblings, 0 replies; 4+ messages in thread
From: Sanan Hasanov @ 2023-01-25 23:58 UTC (permalink / raw)
  To: deller, sam, tzimmermann, geert+renesas, samuel.thibault,
	penguin-kernel, linux-fbdev, dri-devel, linux-kernel
  Cc: contact, syzkaller

Good day, dear maintainers,

We found a bug using a modified kernel configuration file used by syzbot.

We enhanced the coverage of the configuration file using our tool, klocalizer.

Kernel Branch: 6.2.0-rc5-next-20230124
Kernel config: https://drive.google.com/file/d/1F-LszDAizEEH0ZX0HcSR06v5q8FPl2Uv/view?usp=sharing
Reproducer: https://drive.google.com/file/d/1mP1jcLBY7vWCNM60OMf-ogw-urQRjNrm/view?usp=sharing

Thank you!

Best regards,
Sanan Hasanov

================================================================================
UBSAN: shift-out-of-bounds in drivers/video/fbdev/core/fbcon.c:2489:33
shift exponent 35 is too large for 32-bit type 'int'
CPU: 1 PID: 25156 Comm: syz-executor.6 Not tainted 6.2.0-rc5-next-20230124 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 ubsan_epilogue+0xa/0x31 lib/ubsan.c:151
 __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x18d lib/ubsan.c:321
 fbcon_set_font.cold+0x19/0x3c drivers/video/fbdev/core/fbcon.c:2489
 con_font_set drivers/tty/vt/vt.c:4624 [inline]
 con_font_op+0xb4d/0xf10 drivers/tty/vt/vt.c:4671
 vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
 vt_ioctl+0x632/0x2ec0 drivers/tty/vt/vt_ioctl.c:752
 tty_ioctl+0x6fd/0x1520 drivers/tty/tty_io.c:2777
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0x80 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f044068edcd
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0441810bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f04407bbf80 RCX: 00007f044068edcd
RDX: 0000000020000a40 RSI: 0000000000004b72 RDI: 0000000000000003
RBP: 00007f04406fc59c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc5e6a424f R14: 00007ffc5e6a43f0 R15: 00007f0441810d80
 </TASK>
================================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* UBSAN: shift-out-of-bounds in fbcon_set_font
@ 2023-01-25 23:58 ` Sanan Hasanov
  0 siblings, 0 replies; 4+ messages in thread
From: Sanan Hasanov @ 2023-01-25 23:58 UTC (permalink / raw)
  To: deller, sam, tzimmermann, geert+renesas, samuel.thibault,
	penguin-kernel, linux-fbdev, dri-devel, linux-kernel
  Cc: syzkaller, contact

Good day, dear maintainers,

We found a bug using a modified kernel configuration file used by syzbot.

We enhanced the coverage of the configuration file using our tool, klocalizer.

Kernel Branch: 6.2.0-rc5-next-20230124
Kernel config: https://drive.google.com/file/d/1F-LszDAizEEH0ZX0HcSR06v5q8FPl2Uv/view?usp=sharing
Reproducer: https://drive.google.com/file/d/1mP1jcLBY7vWCNM60OMf-ogw-urQRjNrm/view?usp=sharing

Thank you!

Best regards,
Sanan Hasanov

================================================================================
UBSAN: shift-out-of-bounds in drivers/video/fbdev/core/fbcon.c:2489:33
shift exponent 35 is too large for 32-bit type 'int'
CPU: 1 PID: 25156 Comm: syz-executor.6 Not tainted 6.2.0-rc5-next-20230124 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 ubsan_epilogue+0xa/0x31 lib/ubsan.c:151
 __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x18d lib/ubsan.c:321
 fbcon_set_font.cold+0x19/0x3c drivers/video/fbdev/core/fbcon.c:2489
 con_font_set drivers/tty/vt/vt.c:4624 [inline]
 con_font_op+0xb4d/0xf10 drivers/tty/vt/vt.c:4671
 vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
 vt_ioctl+0x632/0x2ec0 drivers/tty/vt/vt_ioctl.c:752
 tty_ioctl+0x6fd/0x1520 drivers/tty/tty_io.c:2777
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0x80 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f044068edcd
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0441810bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f04407bbf80 RCX: 00007f044068edcd
RDX: 0000000020000a40 RSI: 0000000000004b72 RDI: 0000000000000003
RBP: 00007f04406fc59c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc5e6a424f R14: 00007ffc5e6a43f0 R15: 00007f0441810d80
 </TASK>
================================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: UBSAN: shift-out-of-bounds in fbcon_set_font
  2023-01-25 23:58 ` Sanan Hasanov
@ 2023-01-26  8:46   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2023-01-26  8:46 UTC (permalink / raw)
  To: Sanan Hasanov
  Cc: deller, sam, tzimmermann, geert+renesas, samuel.thibault,
	penguin-kernel@I-love.SAKURA.ne.jp, linux-fbdev, dri-devel,
	linux-kernel, contact, syzkaller

Hi Sanan,

On Thu, Jan 26, 2023 at 12:58 AM Sanan Hasanov
<sanan.hasanov@knights.ucf.edu> wrote:
> We found a bug using a modified kernel configuration file used by syzbot.
>
> We enhanced the coverage of the configuration file using our tool, klocalizer.
>
> Kernel Branch: 6.2.0-rc5-next-20230124
> Kernel config: https://drive.google.com/file/d/1F-LszDAizEEH0ZX0HcSR06v5q8FPl2Uv/view?usp=sharing
> Reproducer: https://drive.google.com/file/d/1mP1jcLBY7vWCNM60OMf-ogw-urQRjNrm/view?usp=sharing
>
> Thank you!
>
> Best regards,
> Sanan Hasanov
>
> ================================================================================
> UBSAN: shift-out-of-bounds in drivers/video/fbdev/core/fbcon.c:2489:33
> shift exponent 35 is too large for 32-bit type 'int'

This looks valid to me: con_font_set() checks the font width and height
against max_font_width (64) and max_font_height (128), but fbcon has
stricter limits.

fbcon_set_font() should reject fonts with width > 32 or height > 32.

Thanks!

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] 4+ messages in thread

* Re: UBSAN: shift-out-of-bounds in fbcon_set_font
@ 2023-01-26  8:46   ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2023-01-26  8:46 UTC (permalink / raw)
  To: Sanan Hasanov
  Cc: linux-fbdev, geert+renesas, penguin-kernel@I-love.SAKURA.ne.jp,
	deller, contact, linux-kernel, dri-devel, syzkaller, tzimmermann,
	samuel.thibault, sam

Hi Sanan,

On Thu, Jan 26, 2023 at 12:58 AM Sanan Hasanov
<sanan.hasanov@knights.ucf.edu> wrote:
> We found a bug using a modified kernel configuration file used by syzbot.
>
> We enhanced the coverage of the configuration file using our tool, klocalizer.
>
> Kernel Branch: 6.2.0-rc5-next-20230124
> Kernel config: https://drive.google.com/file/d/1F-LszDAizEEH0ZX0HcSR06v5q8FPl2Uv/view?usp=sharing
> Reproducer: https://drive.google.com/file/d/1mP1jcLBY7vWCNM60OMf-ogw-urQRjNrm/view?usp=sharing
>
> Thank you!
>
> Best regards,
> Sanan Hasanov
>
> ================================================================================
> UBSAN: shift-out-of-bounds in drivers/video/fbdev/core/fbcon.c:2489:33
> shift exponent 35 is too large for 32-bit type 'int'

This looks valid to me: con_font_set() checks the font width and height
against max_font_width (64) and max_font_height (128), but fbcon has
stricter limits.

fbcon_set_font() should reject fonts with width > 32 or height > 32.

Thanks!

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] 4+ messages in thread

end of thread, other threads:[~2023-01-26 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 23:58 UBSAN: shift-out-of-bounds in fbcon_set_font Sanan Hasanov
2023-01-25 23:58 ` Sanan Hasanov
2023-01-26  8:46 ` Geert Uytterhoeven
2023-01-26  8:46   ` 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.