Re: [PATCH] fbcon: Fix a NULL pointer dereference issue in fbcon_putcs

From: Qianqiang Liu
Date: Fri Sep 20 2024 - 11:31:35 EST


Hi,

I simplified the C reproducer as follows:

#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <linux/tiocl.h>
#include <sys/ioctl.h>

struct param {
uint8_t type;
struct tiocl_selection ts;
};

int main()
{
write(1, "executing program\n", sizeof("executing program\n") - 1);

int fd = open("/dev/fb1", 0, 0);

struct fb_con2fbmap con2fb;
con2fb.console = 0x19;
con2fb.framebuffer = 0;
ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb);

int fd1 = open("/dev/tty1", O_RDWR, 0);

struct param param;
param.type = 2;
param.ts.xs = 0;
param.ts.ys = 0;
param.ts.xe = 0;
param.ts.ye = 0;
param.ts.sel_mode = 0;

ioctl(fd1, TIOCLINUX, &param);

con2fb.console = 1;
con2fb.framebuffer = 0;
ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb);

return 0;
}

But I still need time to debug the kernel code..

--
Best,
Qianqiang Liu