Page MenuHomeFreeBSD

pf: unconditionally install headers
AbandonedPublic

Authored by kp on Jan 23 2022, 3:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 7 2024, 12:29 PM
Unknown Object (File)
Feb 22 2024, 4:52 AM
Unknown Object (File)
Jan 14 2024, 2:19 PM
Unknown Object (File)
Nov 8 2023, 5:15 PM
Unknown Object (File)
Nov 8 2023, 12:29 AM
Unknown Object (File)
Nov 7 2023, 5:38 PM
Unknown Object (File)
Nov 5 2023, 5:35 PM
Unknown Object (File)
Oct 23 2023, 10:48 PM
Subscribers

Details

Reviewers
imp
Group Reviewers
network
Summary

Always install the pf headers, even when building with WITHOUT_PF=yes.
If the headers are missing the header validation step (test-includes)
will fail.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 44058
Build 40946: arc lint + arc unit

Event Timeline

kp requested review of this revision.Jan 23 2022, 3:35 PM
imp requested changes to this revision.Jan 23 2022, 4:10 PM

I tried this and got inconsistent result, indicating a different bug in the header validation. It would be better to omit the troubling headers from that validation until I can sort that out.

This revision now requires changes to proceed.Jan 23 2022, 4:10 PM
In D34009#768879, @imp wrote:

I tried this and got inconsistent result, indicating a different bug in the header validation. It would be better to omit the troubling headers from that validation until I can sort that out.

What sort of results did you see? I've tested this with a make universe, and that all builds as I'd expect it to.

This is also something we're going to have to do anyway, unless we change how we install headers from sys/. Those are installed unconditionally, so we always install sys/pfvar.h, which wants to include netpfil/pf/pf.h, which we currently don't install if WITHOUT_PF=yes. So we either always install pf.h, or teach the build system to not install pfvar.h if WITHOUT_PF=yes.

In D34009#768964, @kp wrote:
In D34009#768879, @imp wrote:

I tried this and got inconsistent result, indicating a different bug in the header validation. It would be better to omit the troubling headers from that validation until I can sort that out.

What sort of results did you see? I've tested this with a make universe, and that all builds as I'd expect it to.

I saw it working when it shouldn't, and failing when it shouldn't. That indicated that the understanding of the problem is incorrect and that this solution was not appropriate. to me it points more to testing the wrong thing, or we're installing our staging area incorrectly and this is but one symptom. But this may also point to a bigger issue: if we're only installing some of the dependencies, the dependencies are wrong. I'd like to understand that before hitting it with a huge hammer of always installing everything...

This is also something we're going to have to do anyway, unless we change how we install headers from sys/. Those are installed unconditionally, so we always install sys/pfvar.h, which wants to include netpfil/pf/pf.h, which we currently don't install if WITHOUT_PF=yes. So we either always install pf.h, or teach the build system to not install pfvar.h if WITHOUT_PF=yes.

So why are we always installing pfvar.h? If it's part of pf, it should be omitted WITHOUT_PF...

In D34009#768993, @imp wrote:

I saw it working when it shouldn't, and failing when it shouldn't. That indicated that the understanding of the problem is incorrect and that this solution was not appropriate. to me it points more to testing the wrong thing, or we're installing our staging area incorrectly and this is but one symptom. But this may also point to a bigger issue: if we're only installing some of the dependencies, the dependencies are wrong. I'd like to understand that before hitting it with a huge hammer of always installing everything...

Agreed. I've not seen any unexpected failures or successes with this though, which is why I asked.

So why are we always installing pfvar.h? If it's part of pf, it should be omitted WITHOUT_PF...

As far as I can tell that's because we always install all of the headers from /usr/src/sys/net (and everything listed in LDIRS in include/Makefile), which includes pfvar.h (most pf headers live in netpfil/pf, but not pfvar.h. Userspace expectations mean we can't change that.). At least, that's what it looks like to me, but I don't understand our build system.
If my understanding is correct we could also fix this problem by teaching the build system to not install pfvar.h when WITHOUT_PF is set, but that's not something I know how to do.

In D34009#768999, @kp wrote:
In D34009#768993, @imp wrote:

I saw it working when it shouldn't, and failing when it shouldn't. That indicated that the understanding of the problem is incorrect and that this solution was not appropriate. to me it points more to testing the wrong thing, or we're installing our staging area incorrectly and this is but one symptom. But this may also point to a bigger issue: if we're only installing some of the dependencies, the dependencies are wrong. I'd like to understand that before hitting it with a huge hammer of always installing everything...

Agreed. I've not seen any unexpected failures or successes with this though, which is why I asked.

My big worry is that there's some contamination from the host or from the source tree (since I couldn't recreate this problem just adding WITHOUT_PF to my build). I also had an indication that we might be getting the list from the wrong place since one of the builds couldn't find a file that should have been there, though that only happened once. Based on that, I decided I needed to understand better...

So why are we always installing pfvar.h? If it's part of pf, it should be omitted WITHOUT_PF...

As far as I can tell that's because we always install all of the headers from /usr/src/sys/net (and everything listed in LDIRS in include/Makefile), which includes pfvar.h (most pf headers live in netpfil/pf, but not pfvar.h. Userspace expectations mean we can't change that.). At least, that's what it looks like to me, but I don't understand our build system.
If my understanding is correct we could also fix this problem by teaching the build system to not install pfvar.h when WITHOUT_PF is set, but that's not something I know how to do.

Yea, I'll look at that sometime this week... The last few weeks have been crazy with weird, demanding bugs from $WORK, but I think I've fixed them well enough (I think I got a pathology to stop happening, and made the code robust enough in the face of tiny races when the pathology hits to fail safe) to have some time for this...Is it OK to ask you to sit on this a day or two until this issue bubbles to the top of my list?

Oh, and it doesn't help that I have a mix of meta and non-meta machines I tested this on, which has added to the muddiness of my understanding of why this might be needed.

In D34009#769003, @imp wrote:

Is it OK to ask you to sit on this a day or two until this issue bubbles to the top of my list?

Yes, that's fine. It's not super urgent. It's been broken for a while now, and I'd forgotten about it until Michael Dexter reminded me.

Kristof, how far are we from getting rid of any dependency on net/pfvar.h outside of kernel build? I started the process back in 2013, but back then it was very far from being accomplished. If we are able to accomplish that now, let's just do that and move it to netpfil/pf and problem solved.

Kristof, how far are we from getting rid of any dependency on net/pfvar.h outside of kernel build? I started the process back in 2013, but back then it was very far from being accomplished. If we are able to accomplish that now, let's just do that and move it to netpfil/pf and problem solved.

Pretty far. It's not really been a priority for me.
If nothing else there's an unknowable number of other projects out there that rely on net/pfvar.h including netpfil/pf/pf.h, so I'd be very hesitant to make that move anyway.