On Tue, Mar 22, 2022 at 10:27 PM Daniel Vetter <daniel@xxxxxxxx> wrote: > > On Mon, Mar 21, 2022 at 09:02:47PM +0800, Zheyu Ma wrote: > > On Thu, Mar 17, 2022 at 6:49 PM Daniel Vetter <daniel@xxxxxxxx> wrote: > > > > > > On Fri, Mar 11, 2022 at 07:23:02AM +0000, Zheyu Ma wrote: > > > > The user program can control the 'drm_buf_desc::flags' via ioctl system > > > > call and enter the function drm_legacy_addbufs_agp(). If the driver > > > > doesn't initialize the agp resources, the driver will cause a null > > > > pointer dereference. > > > > > > > > The following log reveals it: > > > > general protection fault, probably for non-canonical address > > > > 0xdffffc000000000f: 0000 [#1] PREEMPT SMP KASAN PTI > > > > KASAN: null-ptr-deref in range [0x0000000000000078-0x000000000000007f] > > > > Call Trace: > > > > <TASK> > > > > drm_ioctl_kernel+0x342/0x450 drivers/gpu/drm/drm_ioctl.c:785 > > > > drm_ioctl+0x592/0x940 drivers/gpu/drm/drm_ioctl.c:885 > > > > vfs_ioctl fs/ioctl.c:51 [inline] > > > > __do_sys_ioctl fs/ioctl.c:874 [inline] > > > > __se_sys_ioctl+0xaa/0xf0 fs/ioctl.c:860 > > > > do_syscall_x64 arch/x86/entry/common.c:50 [inline] > > > > do_syscall_64+0x43/0x90 arch/x86/entry/common.c:80 > > > > entry_SYSCALL_64_after_hwframe+0x44/0xae > > > > > > > > Fix this bug by adding a check. > > > > > > > > Signed-off-by: Zheyu Ma <zheyuma97@xxxxxxxxx> > > > > > > You can only hit this if you enabled a DRIVER_LEGACY drm driver, which > > > opens you up to tons of other CVEs and issues. What's your .config? > > > > Yes, I enable the DRM_LEGACY option in the config. > > I think you mean this is not a normal configuration file? Do you have > > a recommended configuration option for when I want to test the GPU > > driver? > > Yeah DRM_LEGACY gives you all kinds of horrible and known-broken > interfaces. Don't enable that :-) > > You have a bunch of other drivers enable which require DRM_LEGACY, so > those will disable too. Anything else I think would be an upstream bug and > we'd need to adjust Kconfig (or fix the code). Thanks for your explanation! I will pay attention next time. Regards, Zheyu Ma