There is at least one consumer (netgraph) which calls pr_sockaddr and pr_peeraddr from within epoch, which immediately panics with invariants due to malloc(..., M_WAITOK) performed there.
I think a second set of ops should be added which accepts passing a preallocated buffer, even something on-stack.
struct sockaddr has a small upper bound size, so this is very feasible.
Illustrative patch below. If #network is ok with it, I'll make it operational.
Note that callers only need to allocate
```
__offsetof(struct sockaddr, sa_data) + SOCK_MAXADDRLEN
```
bytes. This can be hidden away in struct sockaddr_max or perhaps just a macro indicating the size.
Alternatively a set of routines which take malloc flags can be added, but imo this only adds a failure point (malloc returning NULL) which does not have to exist.
Comments?