Tech YES
11.5K posts

Tech YES
@TechYESCity
The place for enthusiast tech, all BS aside. PC gaming since WC2 and I love me some 80's rock. Channel - https://t.co/pdzyEmB5HI, e-mail: bryan@techc


My new fast Asus router sometimes enters a degraded state in which it force-disassociates clients randomly and forwards packets only after >300ms delays. Rebooting the cluster fixes it, but takes forever and will invariably occur at the wrong time. I dug into the logs and found a likely buffer overflow in dhd.ko, which is binary-only. You can tell because the kernel init logs imply a table entry at offset 4108 in a 4096-byte page and because one of the internal table dumps, when the router is having its fit, just happens to have a protocol magic number and the router's own MAC where a connection status should be. The kernel module wasn't stripped or signed, so I disassembled it, found the init function, had AI (because I'm lazy) generate a binary patch to double the size of the kmalloc allocation for each DHD hardware-shared-memory-heap thing. Fixing the bound wouldn't have helped, I think, because it looks like the code read the table size from the hardware, which would have kept writing past the end no matter what the host kernel did. Easier to waste 40kB. I loaded the new module and restarted the network with a quaint "service restart_wireless". It all seems to work so far. Didn't even have to reboot.






























