Skip to content

Commit 6b74bea

Browse files
committed
kpf: Disable unused fsctl patch
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
1 parent ee8ad2d commit 6b74bea

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

checkra1n/kpf/bindfs.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
#include <stdio.h>
3535
#include <string.h>
3636

37-
extern uint32_t fsctl_shc[], fsctl_shc_vnode_open[], fsctl_shc_stolen_slowpath[], fsctl_shc_orig_bl[], fsctl_shc_vnode_close[], fsctl_shc_stolen_fastpath[], fsctl_shc_orig_b[], fsctl_shc_end[];
38-
3937
static bool do_bind_mounts = false;
4038

39+
// not used in palera1n
40+
#if 0
41+
extern uint32_t fsctl_shc[], fsctl_shc_vnode_open[], fsctl_shc_stolen_slowpath[], fsctl_shc_orig_bl[], fsctl_shc_vnode_close[], fsctl_shc_stolen_fastpath[], fsctl_shc_orig_b[], fsctl_shc_end[];
42+
4143
static uint32_t *fsctl_patchpoint = NULL;
4244
static uint64_t vnode_open_addr = 0, vnode_close_addr = 0;
4345

@@ -140,6 +142,7 @@ static void kpf_fsctl_dev_by_role_patch(xnu_pf_patchset_t *xnu_text_exec_patchse
140142
};
141143
xnu_pf_maskmatch(xnu_text_exec_patchset, "vnode_open_close", vn_matches, vn_masks, sizeof(vn_masks)/sizeof(uint64_t), true, (void*)kpf_vnode_open_close_callback);
142144
}
145+
#endif
143146

144147
static bool kpf_shared_region_root_dir_callback(struct xnu_pf_patch *patch, uint32_t *opcode_stream)
145148
{
@@ -250,7 +253,9 @@ static void kpf_bindfs_patches(xnu_pf_patchset_t *xnu_text_exec_patchset)
250253
// iOS 15.0: Union mounts no longer work
251254
if(do_bind_mounts)
252255
{
256+
#if 0
253257
kpf_fsctl_dev_by_role_patch(xnu_text_exec_patchset);
258+
#endif
254259
kpf_shared_region_root_dir_patch(xnu_text_exec_patchset);
255260
}
256261
}
@@ -278,6 +283,7 @@ static void kpf_bindfs_finish(struct mach_header_64 *hdr)
278283
palera1n_flags |= palerain_option_bind_mount;
279284
}
280285

286+
#if 0
281287
static uint32_t kpf_bindfs_size(void)
282288
{
283289
if(!do_bind_mounts)
@@ -335,13 +341,16 @@ static uint32_t kpf_bindfs_emit(uint32_t *shellcode_area)
335341

336342
return fsctl_shc_end - fsctl_shc;
337343
}
344+
#endif
338345

339346
kpf_component_t kpf_bindfs =
340347
{
341348
.init = kpf_bindfs_init,
342349
.finish = kpf_bindfs_finish,
350+
#if 0
343351
.shc_size = kpf_bindfs_size,
344352
.shc_emit = kpf_bindfs_emit,
353+
#endif
345354
.patches =
346355
{
347356
{ NULL, "__TEXT_EXEC", "__text", XNU_PF_ACCESS_32BIT, kpf_bindfs_patches },

checkra1n/kpf/shellcode.S

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ L_kdi_shc_ramfile:
532532
_kdi_shc_end:
533533

534534

535-
535+
#if 0
536536
.globl _fsctl_shc
537537
.globl _fsctl_shc_vnode_open
538538
.globl _fsctl_shc_stolen_slowpath
@@ -609,3 +609,4 @@ L_fsctl_shc_mnt:
609609
.asciz "/fs/orig"
610610
.align 2
611611
_fsctl_shc_end:
612+
#endif

0 commit comments

Comments
 (0)