Page MenuHomeFreeBSD

icmp: hide icmp_bandlimit_uninit() under VIMAGE
ClosedPublic

Authored by glebius on Mar 22 2024, 9:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 21, 4:52 AM
Unknown Object (File)
Sat, Oct 19, 1:07 AM
Unknown Object (File)
Sat, Oct 19, 1:07 AM
Unknown Object (File)
Fri, Oct 18, 11:11 PM
Unknown Object (File)
Sat, Oct 12, 1:12 AM
Unknown Object (File)
Sep 26 2024, 8:13 PM
Unknown Object (File)
Sep 21 2024, 10:32 AM
Unknown Object (File)
Sep 17 2024, 4:17 PM

Details

Summary

The uninitialization may be executed only on a kernel with VIMAGE.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

When we build without VIMAGE VNET_SYSUNINIT translates to SYSUNINIT, so this patch means we leak V_icmp_rates[i].cr_rate on shutdown.

That's not exactly a critical problem, but this is technically wrong.

In D44476#1014446, @kp wrote:

When we build without VIMAGE VNET_SYSUNINIT translates to SYSUNINIT, so this patch means we leak V_icmp_rates[i].cr_rate on shutdown.
That's not exactly a critical problem, but this is technically wrong.

I don't agree with that. We don't deallocate memory on shutdown in general case. We do not have a matching SYSUNINIT for every SYSINIT that mallocs. Keeping a function to deallocate memory on shutdown is the actual waste of memory - it grows kernel text, which is wired.

In D44476#1014446, @kp wrote:

When we build without VIMAGE VNET_SYSUNINIT translates to SYSUNINIT, so this patch means we leak V_icmp_rates[i].cr_rate on shutdown.
That's not exactly a critical problem, but this is technically wrong.

I don't agree with that. We don't deallocate memory on shutdown in general case. We do not have a matching SYSUNINIT for every SYSINIT that mallocs. Keeping a function to deallocate memory on shutdown is the actual waste of memory - it grows kernel text, which is wired.

That's an argument one could make, yes. I'm inclined to disagree, mostly because not doing the cleanups made the whole vimage introduction a lot harder, but it's a reasonable argument.

I was going to suggest changing VNET_SYSUNINIT to be empty in the !VIMAGE case, but there are cases where we want to do SYSUNINIT anyway, because we want to clean things up on module unload.
That doesn't apply here, of course.

I see there are a number of other VNET_SYSUNINIT's that have the '#ifdef VIMAGE' guard around them. Including one in netipsec/key.c, where it might be wrong due to module unload scenario.

This revision is now accepted and ready to land.Mar 23 2024, 6:01 AM
zlei added a subscriber: zlei.

Looks good to me.