Re: [PATCH 1/2] devcoredump: Remove devcoredump device if failing device is gone

From: Johannes Berg
Date: Tue Jan 30 2024 - 10:52:09 EST


On Tue, 2024-01-30 at 10:49 -0500, Rodrigo Vivi wrote:
>
> I will make changes to our driver to make the 'data' a standalone memory
> that devcoredump will free. this ensures no uaf and no null deref.
> data could be read even after unbinding the driver.
>
> What I meant to userspace 'writing to 'data'' was to ensure that
> on our CI we run something like
>
> if /sys/.../device/devcd<n> exists, then
> echo 1 > /sys/.../device/devcd<n>/data
> before attempting the rmmod <driver>
>
> our rmmod cannot get stuck or our CI is blocked, but then ensuring
> the devcd is gone with module_put happening is the only current way
> of not blocking the rmmod.
>

Ah, you were just concerned about the module removal, sure, that makes
sense.

Though depending on how you make that data pointer: if you just use
*sg() or *v() then you don't have this problem in the first place. OTOH,
it's probably good to have a udev rule to automatically capture the data
in CI anyway (and fail the test if it happened?)

johannes