Re: git: ddd39152743a - main - pf: Introduce M_PF type for pf(4) related memory allocations.
Date: Wed, 03 Sep 2025 09:46:00 UTC
On 3 Sep 2025, at 6:39, Gleb Smirnoff wrote: > On Tue, Sep 02, 2025 at 09:10:53PM +0000, Kristof Provost wrote: > K> The branch main has been updated by kp: > K> > K> URL: https://cgit.FreeBSD.org/src/commit/?id=ddd39152743abc3cff05e7475c0ce48aa303956a > K> > K> commit ddd39152743abc3cff05e7475c0ce48aa303956a > K> Author: Kristof Provost <kp@FreeBSD.org> > K> AuthorDate: 2025-08-18 12:19:40 +0000 > K> Commit: Kristof Provost <kp@FreeBSD.org> > K> CommitDate: 2025-09-02 21:10:20 +0000 > K> > K> pf: Introduce M_PF type for pf(4) related memory allocations. > K> > K> Currently used M_TEMP and M_IFADDR types are unreasonable for that purpose. > K> This dedicated statistics simplify the future pf(4) unlocking work by decreasing > K> search area of possible memory leaks. > > IMHO, going away from M_TEMP to something else for allocations that last for > duration of a syscall is a regression rather than an improvement. > I can see the argument, however, I think there are sufficient reasons for it anyway. The first is that not all of these allocations are correctly M_TEMP anyway. It was used to allocate struct pf_krule_global for example (as well as anchors). The second is that this indeed revealed memory leaks (since fixed) that we wouldn’t have been aware of otherwise (and that does also apply to allocations that are temporary). See 44cc3b2731914f94851c0e468a5fa07c5f6ca006 for that one. And finally, the usual argument of diff reduction with OpenBSD. Although to be fair, it’s not exactly hard to change the malloc type when porting patches, but it is yet another opportunity to mess something up. Best regards, Kristof