Skip to content

Commit

Permalink
Fix VTOY_LINUX_REMOUNT option for latest CentOS 9 Stream. (#2827)
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed May 19, 2024
1 parent d672af4 commit c16e761
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 4 deletions.
13 changes: 11 additions & 2 deletions DMPATCH/dmpatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef struct ko_param
unsigned long blkdev_put_addr;
unsigned long bdev_open_addr;
unsigned long kv_subminor;
unsigned long bdev_file_open_addr;
unsigned long padding[1];
}ko_param;

Expand Down Expand Up @@ -318,12 +319,19 @@ static unsigned int notrace dmpatch_patch_claim_ptr(void)

if (dmpatch_kv_above(6, 7, 0)) /* >= 6.7 kernel */
{
vdebug("Get addr: 0x%lx %lu 0x%lx\n", g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_open_addr);
vdebug("Get addr: 0x%lx %lu open 0x%lx\n", g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_open_addr);
offset1 = dmpatch_find_call_offset(g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_open_addr);
if (offset1 == 0)
{
vdebug("call bdev_open_addr Not found\n");
return 1;

vdebug("Get addr: 0x%lx %lu file_open 0x%lx\n", g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_file_open_addr);
offset1 = dmpatch_find_call_offset(g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_file_open_addr);
if (offset1 == 0)
{
vdebug("call bdev_file_open_addr Not found\n");
return 1;
}
}
}
else
Expand All @@ -339,6 +347,7 @@ static unsigned int notrace dmpatch_patch_claim_ptr(void)
return 1;
}
}


vdebug("call addr1:0x%lx call addr2:0x%lx\n",
g_ko_param.sym_get_addr + offset1,
Expand Down
8 changes: 6 additions & 2 deletions IMG/cpio/ventoy/hook/ventoy-hook-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ ventoy_dm_patch() {
vtlog "get bdev_open_by_dev address $vtLine"
bdev_open_addr=$(echo $vtLine | $AWK '{print $1}')

vtLine=$($VTOY_PATH/tool/vtoyksym bdev_file_open_by_dev $VTOY_PATH/kallsyms)
vtlog "get bdev_file_open_by_dev address $vtLine"
bdev_file_open_addr=$(echo $vtLine | $AWK '{print $1}')


if $GREP -m1 -q 'close_table_device.isra' $VTOY_PATH/kallsyms; then
vtLine=$($VTOY_PATH/tool/vtoyksym close_table_device.isra $VTOY_PATH/kallsyms)
Expand Down Expand Up @@ -398,7 +402,7 @@ ventoy_dm_patch() {
vtlog put_addr=$put_addr put_size=$put_size
vtlog blkdev_get_addr=$blkdev_get_addr blkdev_put_addr=$blkdev_put_addr
vtlog kprobe_reg_addr=$kprobe_reg_addr kprobe_unreg_addr=$kprobe_unreg_addr
vtlog ro_addr=$ro_addr rw_addr=$rw_addr printk_addr=$printk_addr bdev_open_addr=$bdev_open_addr
vtlog ro_addr=$ro_addr rw_addr=$rw_addr printk_addr=$printk_addr bdev_open_addr=$bdev_open_addr bdev_file_open_addr=$bdev_file_open_addr

if [ "$get_addr" = "0" -o "$put_addr" = "0" ]; then
vtlog "Invalid symbol address"
Expand Down Expand Up @@ -460,7 +464,7 @@ ventoy_dm_patch() {
#step2: fill parameters
vtPgsize=$($VTOY_PATH/tool/vtoyksym -p)

vtPrams="$VTOY_PATH/tool/$vtKoName $vtPgsize 0x$printk_addr 0x$ro_addr 0x$rw_addr $get_addr $get_size $put_addr $put_size 0x$kprobe_reg_addr 0x$kprobe_unreg_addr $vtKVMajor $vtIBT $vtKVMinor $blkdev_get_addr $blkdev_put_addr $vtKVSubMinor $bdev_open_addr $vtDebug"
vtPrams="$VTOY_PATH/tool/$vtKoName $vtPgsize 0x$printk_addr 0x$ro_addr 0x$rw_addr $get_addr $get_size $put_addr $put_size 0x$kprobe_reg_addr 0x$kprobe_unreg_addr $vtKVMajor $vtIBT $vtKVMinor $blkdev_get_addr $blkdev_put_addr $vtKVSubMinor $bdev_open_addr $bdev_file_open_addr $vtDebug"


vtlog "$VTOY_PATH/tool/vtoykmod -f $vtPrams"
Expand Down
Binary file modified IMG/cpio_x86/ventoy/tool/dm_patch_64.ko
Binary file not shown.
Binary file modified IMG/cpio_x86/ventoy/tool/dm_patch_ibt_64.ko
Binary file not shown.
3 changes: 3 additions & 0 deletions VtoyTool/vtoykmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ typedef struct ko_param
unsigned long blkdev_put_addr;
unsigned long bdev_open_addr;
unsigned long kv_subminor;
unsigned long bdev_file_open_addr;
unsigned long padding[1];
}ko_param;

Expand Down Expand Up @@ -581,6 +582,7 @@ int vtoykmod_fill_param(char **argv)
param->blkdev_put_addr = strtoul(argv[15], NULL, 16);
param->kv_subminor = strtoul(argv[16], NULL, 10);
param->bdev_open_addr = strtoul(argv[17], NULL, 16);
param->bdev_file_open_addr = strtoul(argv[18], NULL, 16);

debug("pgsize=%lu (%s)\n", param->pgsize, argv[1]);
debug("printk_addr=0x%lx (%s)\n", param->printk_addr, argv[2]);
Expand All @@ -599,6 +601,7 @@ int vtoykmod_fill_param(char **argv)
debug("blkdev_put_addr=0x%lx (%s)\n", param->blkdev_put_addr, argv[15]);
debug("kv_subminor=%lu (%s)\n", param->kv_subminor, argv[16]);
debug("bdev_open_addr=0x%lx (%s)\n", param->bdev_open_addr, argv[17]);
debug("bdev_file_open_addr=0x%lx (%s)\n", param->bdev_file_open_addr, argv[18]);

break;
}
Expand Down
Binary file modified VtoyTool/vtoytool/00/vtoytool_32
Binary file not shown.
Binary file modified VtoyTool/vtoytool/00/vtoytool_64
Binary file not shown.
Binary file modified VtoyTool/vtoytool/00/vtoytool_aa64
Binary file not shown.
Binary file modified VtoyTool/vtoytool/00/vtoytool_m64e
Binary file not shown.

0 comments on commit c16e761

Please sign in to comment.