Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Linux 6.5 support to avoid fortify panic #948

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

brian90013
Copy link
Contributor

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".

Fortify was detecting "buffer overflow in strcpy" in tc_configure()
where a string is copied into a TCA_KIND attribute. The nlreq object has
sufficient space with a 100 character buffer but the attribute pointer
is set to &nlreq.hdr which has a fixed sized. By changing the pointer to
&nlreq, fortify is able to see the extra bytes and not panic.

Also remove a duplicate strcpy() in netmap_sink_init().
@giuseppelettieri
Copy link
Collaborator

thanks!

@giuseppelettieri giuseppelettieri merged commit d75ef42 into luigirizzo:master Feb 28, 2024
@brian90013 brian90013 deleted the linux-6.5-fortify branch February 28, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants