B Horn 500e5fdd82 kern/dl: Fix for an integer overflow in grub_dl_ref()
It was possible to overflow the value of mod->ref_count, a signed
integer, by repeatedly invoking insmod on an already loaded module.
This led to a use-after-free. As once ref_count was overflowed it became
possible to unload the module while there was still references to it.

This resolves the issue by using grub_add() to check if the ref_count
will overflow and then stops further increments. Further changes were
also made to grub_dl_unref() to check for the underflow condition and
the reference count was changed to an unsigned 64-bit integer.

Reported-by: B Horn <b@horn.uk>
Signed-off-by: B Horn <b@horn.uk>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-02-13 15:45:55 +01:00
..
2010-09-15 14:46:53 +02:00
2023-12-12 17:55:14 +01:00
2022-03-14 16:01:07 +01:00
2023-05-17 13:23:44 +02:00
2023-06-01 11:45:00 +02:00
2024-11-28 21:50:55 +01:00
2013-11-07 06:35:50 +01:00
2022-03-14 16:01:07 +01:00