Fix VTOY_LINUX_REMOUNT option for latest CentOS 9 Stream. (#2827)

This commit is contained in:
longpanda 2024-05-19 15:35:05 +08:00
parent d672af4819
commit c16e76130b
9 changed files with 20 additions and 4 deletions

View File

@ -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;
@ -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
@ -340,6 +348,7 @@ static unsigned int notrace dmpatch_patch_claim_ptr(void)
}
}
vdebug("call addr1:0x%lx call addr2:0x%lx\n",
g_ko_param.sym_get_addr + offset1,
g_ko_param.sym_put_addr + offset2);

View File

@ -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)
@ -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"
@ -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"

View File

@ -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;
@ -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]);
@ -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;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.