Page MenuHomeFreeBSD

Set vnet when calling pru_sockaddr and pru_peeraddr
ClosedPublic

Authored by tuexen on Dec 27 2017, 2:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 5:13 PM
Unknown Object (File)
Sun, Apr 21, 5:13 PM
Unknown Object (File)
Sun, Apr 21, 5:13 PM
Unknown Object (File)
Sat, Apr 20, 2:40 AM
Unknown Object (File)
Fri, Apr 19, 2:06 PM
Unknown Object (File)
Jan 27 2024, 8:03 AM
Unknown Object (File)
Jan 27 2024, 8:03 AM
Unknown Object (File)
Jan 27 2024, 8:03 AM
Subscribers

Details

Summary

When pru_sockaddr is called from kern_getsockname(), the vnet is set. This is also true when pru_peeraddr is called via kern_getpeername(). However, the vnet is not net when these functions are called from soo_fill_kinfo(). This patch ensures that the vnet is also set in this case.

The corresponding SCTP functions assume the vnet to be set correctly. Right now, when a program with an wildcard bound SCTP socket crashes, the machines panics when trying to write the core file.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Seems this came in in r271976 with D775 after VIMAGE was in the tree.
You don't need to set the CURVNET() that early (only after the switch) it seems but it shouldn't matter.
Looks OK to me.

This revision is now accepted and ready to land.Jan 11 2018, 6:06 PM
This revision was automatically updated to reflect the committed changes.