luigirizzo / netmap

Automatically exported from code.google.com/p/netmap
BSD 2-Clause "Simplified" License
1.86k stars 537 forks source link

Fix Linux 6.5 support to avoid fortify panic #948

Closed brian90013 closed 8 months ago

brian90013 commented 8 months ago

Hello,

I believe this patch is a fix for issue #937 where fortify causes a panic in tc_configure() due to a "detected buffer overflow in strcpy". The nlattr * is set to &nlreq.hdr which has a fixed size causing the overflow. By setting nlattr * to &nlreq instead, the code sees the 100 byte buf space and does not panic. I tested this on kernel 6.5.0-21 and verified the qdisc name was properly set by using tc. With the fix I could run pkt-gen on multiple emulated netmap interfaces without seeing a panic.

While here I removed a duplicate strcpy() in netmap_sink_init(). I assumed "nmsink" is preferred to "nmsink%d".

giuseppelettieri commented 8 months ago

thanks!