Hi, I was trying to increase the maximum socket buffer size (SB_MAX or kern.maxsockbuf) in my kernel and I realized that the maximum I could go was: 2097151 (2^21 - 1). If the SB_MAX was >= 2^21 I could not open any socket. After spending a lot of time I realised that in the file: kern/uipc_socket2.c in the sbreserve function there is the following line: if (cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES)) Taking into account that the highest number we can have is 2^32 -1 and that MCLBYTES = 2048 = 2^11 it is obvious that if sb_max was 2^21 we would have an overflow (sb_max * MCLBYTES = 2^21 * 2^11 = 2^32 overflow) Fix: The above can be easily corrected by replacing the above line with the following: if (cc > (sb_max / (MSIZE + MCLBYTES)) * MCLBYTES) In this case we can have SB_MAX with greater values. Thanks.
State Changed From-To: open->suspended awaiting review & comitter
State Changed From-To: suspended->analyzed This change seems reasonable, I'll doublecheck the patch and get it committed.
Responsible Changed From-To: freebsd-bugs->silby
State Changed From-To: analyzed->closed A modified version of this change has been committed to -current, and it will be mfc'd to -stable in 3 weeks.