[Bug 281035] agp driver kernel panic on 14.1 - agp_close(): page fault while in kernel mode

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 24 Aug 2024 14:57:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281035

            Bug ID: 281035
           Summary: agp driver kernel panic on 14.1 - agp_close(): page
                    fault while in kernel mode
           Product: Base System
           Version: 14.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: doktornotor@mailinator.com

Created attachment 253058
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=253058&action=edit
Boot log with the agp_close() kernel panic and backtrace

Poking /dev/agpgart is enough to trigger kernel panic via loaded agp(4) driver
[0]. While this was originally discovered by running

> env ZPOOL_IMPORT_PATH=/dev zpool import -Na

which in turn tries to openat(2) everything under /dev tree including
/dev/agpgart, which then triggers agp_close() [1] call in the driver, and then
you get kernel panic. Attached there is a boot log including the moment where
the system crashes, that is when the above zpool import is called.)

I believe simply doing 

> echo > /dev/agpgart

will do the same job - feel feel to try if you have some vintage hardware to
crash.

*** 
Note: I do NOT have any hardware to reproduce, test any fixes or whatever else
here, provide core dumps or whatever similar. However, this was reproduced by
multiple users [2] and caused completely unexpected fatal system crashes.
***

Recompiling the kernel without the agp(4) driver avoids this issue. Also, using 

> set hint.agp.0.disabled=1

at loader prompt avoids the issue (also confirmed by multiple users).

Suggestion: Perhaps follow the kernel warning

> WARNING: Device "agp" is Giant locked and may be deleted before FreeBSD 15.0.

and delete the driver from FreeBSD as soon as practicable. Having it in kernel
in this state is doing more harm than good. (There is also another bug unsolved
and open since 2014, which also results in unbootable systems [3]).

[0] https://man.freebsd.org/cgi/man.cgi?query=agp&sektion=4&format=html
[1]
https://github.com/freebsd/freebsd-src/blob/5cbb98c8259c48ba22c8359f4c14f5438329ce58/sys/dev/agp/agp.c#L829
[2] https://forum.opnsense.org/index.php?topic=42373.0
[3] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=187015

-- 
You are receiving this mail because:
You are the assignee for the bug.