Page MenuHomeFreeBSD

inpcb: poison several inpcb pointer in in_pcbfree()
ClosedPublic

Authored by glebius on Dec 20 2023, 7:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 21, 5:04 AM
Unknown Object (File)
Fri, Oct 18, 11:25 PM
Unknown Object (File)
Fri, Oct 18, 9:36 AM
Unknown Object (File)
Sep 30 2024, 11:42 PM
Unknown Object (File)
Sep 29 2024, 12:20 PM
Unknown Object (File)
Sep 26 2024, 8:58 AM
Unknown Object (File)
Sep 22 2024, 9:12 AM
Unknown Object (File)
Sep 22 2024, 12:37 AM
Subscribers

Details

Summary

There are few subsystems that reference inpcb and allow it to outlive
in_pcbfree(). There are no known bugs with them to unreference the
socket and options pointers for a freed inpcb. Enforce this so that
such bugs don't appear in the future.

Diff Detail

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

Event Timeline

Setting socket to non-NULL was too much of a change.

sys/netinet/in_pcb.c
1761

I think this should probably be unconditional? i.e., not dependent on whether INP_IPV6PROTO is set.

I'd prefer to leave it conditional if you don't mind. The field is IPv6 specific. In the past I tried to unionize IPv4 and IPv6 stuff in the inpcb. The blunt attempt failed, most likely due to 4to6 mapped connections. Maybe in future I'll make a smarter attempt. If that succeeds, then we should trash v6 pointers only for a INP_IPV6PROTO pcb.

I'd prefer to leave it conditional if you don't mind. The field is IPv6 specific. In the past I tried to unionize IPv4 and IPv6 stuff in the inpcb. The blunt attempt failed, most likely due to 4to6 mapped connections. Maybe in future I'll make a smarter attempt. If that succeeds, then we should trash v6 pointers only for a INP_IPV6PROTO pcb.

I don't mind, but IMHO it is a strange argument: it is not much work to move the poisoning back later if needed.

This revision is now accepted and ready to land.Dec 27 2023, 3:18 PM