Skip to content

Instantly share code, notes, and snippets.

@asahilina
Created March 6, 2023 14:54
Show Gist options
  • Save asahilina/7f84ec3d8d3fc59abb1d73a803dc4f15 to your computer and use it in GitHub Desktop.
Save asahilina/7f84ec3d8d3fc59abb1d73a803dc4f15 to your computer and use it in GitHub Desktop.
@mixi
Copy link

mixi commented Mar 6, 2023

The kernel limits it to min(8k, PAGE_SIZE), so you do not need that big of a buffer. The size is defined in the NLMSG_GOODSIZE macro in include/linux/netlink.h. The kernel netlink code will happily utilize a bigger buffer after the first dump call though.

@ericcurtin
Copy link

ericcurtin commented Mar 6, 2023

I'm hoping the real fix contributed is what @asahilina proposed elsewhere:

std::vector buffer(base::GetPageSize());

Juts don't use fixed stack sizes for page size constrained buffers at all, and you fix this problem forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment