in_pcb: add in_pcbrele_rlock() The helper the derefs and rlock the provided inp. Returns false if inp is still usable. sysctl net.inet.tcp.ktlslist: allow snd_tag_status_str() to sleep For this, unlock inp around the calls, taking the reference on it. If the inp appears to be freed or unlinked after the relock, restart the loop. In case we already copying out some data, the request oldidx is rewind.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/netinet/in_pcb.c | ||
---|---|---|
1748 | ||
1749 | Those semantics seem backwards. inp_trylock(), inp_smr_lock() both return true if the operation succeeded, false otherwise. | |
sys/netinet/tcp_subr.c | ||
2728 | I worry that this loop will not terminate on busy systems, e.g., if they are undergoing some DOS and inpcbs are being recycled frequently. An alternate approach would be to define some marker inpcb that lets you keep your place, but the implementation will be more challenging. |
Mention the owned reference in the comment.
Limit the number of restarts for sysctl handler.
sys/netinet/tcp_subr.c | ||
---|---|---|
2728 | I forgot to commit it. |
I can't say that I am happy with this change, sorry. But looks like you need it, so let it be so.
All this hardware TLS assist is a crazy layer violation. But this is a wave a can't stand against.
That's why you need to sleep in the all inpcb iterator, which definitely was not designed for that. I can suggest that the iterator just returns to the userland the list of ktls enabled pcbs, and then a user level binary would iterate them one by one and request whatever it needs to be requested in a sleepable context, a syscall per pcb. I don't know if that will fit your needs or if you want to implement that.
https://kib.kiev.ua/kib/cats_Ln.jpg
That's why you need to sleep in the all inpcb iterator, which definitely was not designed for that. I can suggest that the iterator just returns to the userland the list of ktls enabled pcbs, and then a user level binary would iterate them one by one and request whatever it needs to be requested in a sleepable context, a syscall per pcb. I don't know if that will fit your needs or if you want to implement that.
And then kernel needs to validate passed inpcb address to be really inpcb, which involves re-walking the inpcb list. Basically, the linear scan is replaced by N^2.