Compare commits

...

4 Commits

@ -21,7 +21,7 @@ body:
attributes:
label: Ventoy Version
description: What version of ventoy are you running?
placeholder: 1.0.91
placeholder: 1.0.96
validations:
required: true
- type: dropdown

@ -78,15 +78,25 @@ static volatile ko_param g_ko_param =
#define PATCH_OP_POS2 1
#define CODE_MATCH2(code, i) \
(code[i] == 0x0C && code[i + 1] == 0x80 && code[i + 2] == 0x89 && code[i + 3] == 0xC6)
#define PATCH_OP_POS3 4
#define CODE_MATCH3(code, i) \
(code[i] == 0x44 && code[i + 1] == 0x89 && code[i + 2] == 0xe8 && code[i + 3] == 0x0c && code[i + 4] == 0x80)
#elif defined(CONFIG_X86_32)
#define PATCH_OP_POS1 2
#define CODE_MATCH1(code, i) \
(code[i] == 0x80 && code[i + 1] == 0xca && code[i + 2] == 0x80 && code[i + 3] == 0xe8)
#define PATCH_OP_POS2 2
#define CODE_MATCH2(code, i) \
(code[i] == 0x80 && code[i + 1] == 0xca && code[i + 2] == 0x80 && code[i + 3] == 0xe8)
#define PATCH_OP_POS2 PATCH_OP_POS1
#define CODE_MATCH2 CODE_MATCH1
#define PATCH_OP_POS3 PATCH_OP_POS1
#define CODE_MATCH3 CODE_MATCH1
#else
#error "unsupported arch"
@ -173,7 +183,7 @@ static int notrace dmpatch_replace_code
vdebug("patch for %s style[%d] 0x%lx %d\n", desc, style, addr, (int)size);
for (i = 0; i < (int)size - 4; i++)
for (i = 0; i < (int)size - 8; i++)
{
if (style == 1)
{
@ -183,7 +193,7 @@ static int notrace dmpatch_replace_code
cnt++;
}
}
else
else if (style == 2)
{
if (CODE_MATCH2(opCode, i) && cnt < MAX_PATCH)
{
@ -191,8 +201,20 @@ static int notrace dmpatch_replace_code
cnt++;
}
}
else if (style == 3)
{
if (CODE_MATCH3(opCode, i) && cnt < MAX_PATCH)
{
patch[cnt] = opCode + i + PATCH_OP_POS3;
cnt++;
}
}
}
if (cnt != expect || cnt >= MAX_PATCH)
{
vdebug("patch error: cnt=%d expect=%d\n", cnt, expect);
@ -297,9 +319,16 @@ static int notrace dmpatch_init(void)
r = dmpatch_replace_code(1, g_ko_param.sym_get_addr, g_ko_param.sym_get_size, 2, "dm_get_table_device", g_get_patch);
if (r && g_ko_param.kv_major >= 5)
{
vdebug("new patch dm_get_table_device...\n");
vdebug("new2 patch dm_get_table_device...\n");
r = dmpatch_replace_code(2, g_ko_param.sym_get_addr, g_ko_param.sym_get_size, 1, "dm_get_table_device", g_get_patch);
}
if (r && g_ko_param.kv_major >= 5)
{
vdebug("new3 patch dm_get_table_device...\n");
r = dmpatch_replace_code(3, g_ko_param.sym_get_addr, g_ko_param.sym_get_size, 1, "dm_get_table_device", g_get_patch);
}
if (r)
{

@ -1,10 +1,12 @@
1. install ubuntu 21.10
2. apt-get install build-essential flex libncurses-dev linux-headers-generic linux-source libssl-dev ...... and so on
3. cp /lib/modules/5.13.0-23-generic/build/Module.symvers ./
4. /boot/config-5.13.0-23-generic as .config make oldconfig
1. install ubuntu 22.04 5.15.0-25
2. apt-get install build-essential flex libncurses-dev linux-headers-generic linux-source libssl-dev bison yacc vim libelf-dev ...... and so on
3. cp /lib/modules/5.15.0-25-generic/build/Module.symvers ./
4. /boot/config-5.15.0-25-generic as .config make oldconfig
5. make menuconfig
1. close CONFIG_STACKPROTECTOR
2. close CONFIG_RETPOLINE
3. close CONFIG_UBSAN_BOUNDS
4. close CONFIG_UBSAN_ENUM
6. modify ./scripts/mod/modpost.c
1. skip add_srcversion (just return)

@ -1,6 +1,6 @@
#!/bin/bash
FTPIP=168.0.0.209
FTPIP=192.168.44.1
FTPUSR='a:a'
rm -f dmpatch.c Makefile Makefile_IBT
@ -27,7 +27,7 @@ mkdir ./aa
cp -a *.c aa/
cp -a Makefile aa/
cd /home/panda/linux-source-5.13.0
cd /home/panda/linux-source-5.15.0
make modules M=/home/panda/build/aa/
strip --strip-debug /home/panda/build/aa/dm_patch.ko
cd -
@ -43,7 +43,7 @@ mkdir ./aa
cp -a *.c aa/
cp -a Makefile_IBT aa/Makefile
cd /home/panda/linux-source-5.13.0
cd /home/panda/linux-source-5.15.0
make modules M=/home/panda/build/aa/
strip --strip-debug /home/panda/build/aa/dm_patch_ibt.ko
cd -

@ -54,6 +54,21 @@ if [ -z "$dmsetup_path" ]; then
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
fi
if [ -f /proc/devices ]; then
vtlog "/proc/devices exist OK"
else
for i in 1 2 3 4 5 6 7 8 9; do
if [ -f /proc/devices ]; then
vtlog "/proc/devices exist OK now"
break
else
vtlog "/proc/devices NOT exist, wait $i"
$BUSYBOX_PATH/sleep 1
fi
done
fi
ventoy_udev_disk_common_hook $*
# OK finish

@ -209,11 +209,20 @@ ventoy_check_dm_module() {
vtlog "modprobe failed, now try to insmod ko..."
$FIND /lib/modules/ -name "dm-mod.ko*" | while read vtline; do
vtlog "insmode $vtline "
vtlog "insmod $vtline "
$BUSYBOX_PATH/insmod $vtline >>$VTLOG 2>&1
if [ $? -eq 0 ]; then
vtlog "insmod success"
else
vtlog "insmod failed, try decompress"
if echo $vtline | $GREP -q "\.zst"; then
$VTOY_PATH/tool/zstdcat $vtline > $VTOY_PATH/extract_dm_mod.ko
$BUSYBOX_PATH/insmod $VTOY_PATH/extract_dm_mod.ko >>$VTLOG 2>&1
fi
fi
done
fi
if $GREP -q 'device-mapper' /proc/devices; then
vtlog "device-mapper found in /proc/devices after retry"
$BUSYBOX_PATH/true; return
@ -292,6 +301,7 @@ ventoy_need_dm_patch() {
}
ventoy_dm_patch() {
vtDmPatchDebug=0
vtMType=$($BUSYBOX_PATH/uname -m)
vtlog "######### ventoy_dm_patch ############"
@ -350,6 +360,15 @@ ventoy_dm_patch() {
kprobe_unreg_addr=$($GREP ' unregister_kprobe$' /proc/kallsyms | $AWK '{print $1}')
if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
vtDmPatchDebug=1
fi
if $GREP -q 'dmpatch_debug' /proc/cmdline; then
vtDmPatchDebug=1
fi
if [ $vtDmPatchDebug -eq 1 ]; then
printk_addr=$($GREP ' printk$' /proc/kallsyms | $AWK '{print $1}')
if [ -z "$printk_addr" ]; then
printk_addr=$($GREP ' _printk$' /proc/kallsyms | $AWK '{print $1}')
@ -384,14 +403,17 @@ ventoy_dm_patch() {
return
elif [ -d /lib/modules/$vtKv/kernel/fs ]; then
vtModPath=$($FIND /lib/modules/$vtKv/kernel/fs/ -name "*.ko*" | $HEAD -n1)
else
elif [ -d /lib/modules/$vtKv/kernel ]; then
vtModPath=$($FIND /lib/modules/$vtKv/kernel/ -name "xfs.ko*" | $HEAD -n1)
elif [ -d /lib/modules/$vtKv/initrd ]; then
vtModPath=$($FIND /lib/modules/$vtKv/initrd/ -name "xfs.ko*" | $HEAD -n1)
fi
if [ -z "$vtModPath" ]; then
vtModPath=$($FIND /lib/modules/$vtKv/kernel/ -name "*.ko*" | $HEAD -n1)
vtModPath=$($FIND /lib/modules/$vtKv/ -name "*.ko*" | $HEAD -n1)
fi
vtModName=$($BUSYBOX_PATH/basename $vtModPath)
vtlog "template module is $vtModPath $vtModName"
@ -405,6 +427,8 @@ ventoy_dm_patch() {
$BUSYBOX_PATH/xzcat $vtModPath > $VTOY_PATH/$vtModName
elif echo $vtModPath | $GREP -q "[.]ko[.]gz$"; then
$BUSYBOX_PATH/zcat $vtModPath > $VTOY_PATH/$vtModName
elif echo $vtModPath | $GREP -q "[.]ko[.]zst$"; then
$VTOY_PATH/tool/zstdcat $vtModPath > $VTOY_PATH/$vtModName
else
vtlog "unsupport module type"
return
@ -414,17 +438,21 @@ ventoy_dm_patch() {
#step1: modify vermagic/mod crc/relocation
vtlog "$VTOY_PATH/tool/vtoykmod -u $VTOY_PATH/tool/$vtKoName $VTOY_PATH/$vtModName $vtDebug"
$VTOY_PATH/tool/vtoykmod -u $VTOY_PATH/tool/$vtKoName $VTOY_PATH/$vtModName $vtDebug
$VTOY_PATH/tool/vtoykmod -u $VTOY_PATH/tool/$vtKoName $VTOY_PATH/$vtModName $vtDebug >>$VTLOG 2>&1
#step2: fill parameters
vtPgsize=$($VTOY_PATH/tool/vtoyksym -p)
vtlog "$VTOY_PATH/tool/vtoykmod -f $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 $vtKv $vtIBT $vtDebug"
$VTOY_PATH/tool/vtoykmod -f $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 $vtKv $vtIBT $vtDebug
$VTOY_PATH/tool/vtoykmod -f $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 $vtKv $vtIBT $vtDebug >>$VTLOG 2>&1
$BUSYBOX_PATH/insmod $VTOY_PATH/tool/$vtKoName
vtlog "insmod $VTOY_PATH/tool/$vtKoName"
$BUSYBOX_PATH/insmod $VTOY_PATH/tool/$vtKoName >>$VTLOG 2>&1
if $GREP -q 'dm_patch' /proc/modules; then
vtlog "dm_patch module OK"
echo "done" > $VTOY_PATH/dm_patch_done
else
vtlog "dm_patch module FAILED"
fi
}

@ -2397,7 +2397,7 @@ function mimg_common_menuentry {
#############################################################
#############################################################
set VENTOY_VERSION="1.0.95"
set VENTOY_VERSION="1.0.96"
#ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1

@ -0,0 +1,19 @@
L - Selezione lingua
F1 - Mostra informazioni di aiuto
F2 - Sfoglia e avvia file sul disco locale
F3 - Cambia la modalità del menu tra VistaAlbero <-> VistaLista
F4 - Avvia Windows/Linux sul disco locale
F5 - Utilità
F6 - Carica il menu Grub2 personalizzato
F7 - Passa tra Modalità GUI <-> Modalità TESTO
m/Ctrl+m - Checksum dei file immagine (md5/sha1/sha256/sha512)
d/Ctrl+d - Modalità Memdisk (Solo per i file ISO/IMG di WinPE/LiveCD piccoli)
w/Ctrl+w - Modalità WIMBOOT (SOlo per i file ISO di Windows/WinPE)
r/Ctrl+r - Modalità Grub2 (Solo per alcune distro Linux)
i/Ctrl+i - Modalità Compatibile (Solo per debugging)
u/Ctrl+u - Carica driver EFI ISO (Solo per debugging, non può essere usato ufficialmente)
Premi ESC per ritornare ......

@ -0,0 +1,93 @@
{
"VTLANG_LANGUAGE_NAME": "Italiano (Italian)",
"VTLANG_STR_HOTKEY_LIST": "L:Lingua F1:Aiuto F2:Sfoglia F3:VistaLista F4:BootLocale F5:Strumenti F6:ExMenu",
"VTLANG_STR_HOTKEY_TREE": "L:Lingua F1:Aiuto F2:Sfoglia F3:VistaAlbero F4:BootLocale F5:Strumenti F6:ExMenu",
"VTLANG_RETURN_PREVIOUS": "Ritorna al menu precedente [Esc]",
"VTLANG_RETURN_PRV_NOESC": "Ritorna al menu precedente",
"VTLANG_MENU_LANG": "Menu selezione lingua",
"VTLANG_LB_SBOOT_WINDOWS": "Cerca e avvia Windows",
"VTLANG_LB_SBOOT_G4D": "Cerca e avvia Grub4dos",
"VTLANG_LB_SBOOT_HDD1": "Avvia il 1° disco locale",
"VTLANG_LB_SBOOT_HDD2": "Avvia il 2° disco locale",
"VTLANG_LB_SBOOT_HDD3": "Avvia il 3° disco locale",
"VTLANG_LB_SBOOT_X64EFI": "Cerca e avvia BOOTX64.EFI",
"VTLANG_LB_SBOOT_IA32EFI": "Cerca e avvia BOOTIA32.EFI",
"VTLANG_LB_SBOOT_AA64EFI": "Cerca e avvia BOOTAA64.EFI",
"VTLANG_LB_SBOOT_XORBOOT": "Cerca e avvia xorboot",
"VTLANG_FILE_CHKSUM": "Checksum file",
"VTLANG_CHKSUM_MD5_CALC": "Calcola md5sum",
"VTLANG_CHKSUM_SHA1_CALC": "Calcola sha1sum",
"VTLANG_CHKSUM_SHA256_CALC": "Calcola sha256sum",
"VTLANG_CHKSUM_SHA512_CALC": "Calcola sha512sum",
"VTLANG_CHKSUM_MD5_CALC_CHK": "Calcola e controlla md5sum",
"VTLANG_CHKSUM_SHA1_CALC_CHK": "Calcola e controlla sha1sum",
"VTLANG_CHKSUM_SHA256_CALC_CHK": "Calcola e controlla sha256sum",
"VTLANG_CHKSUM_SHA512_CALC_CHK": "Calcola e controlla sha512sum",
"VTLANG_POWER": "Spegni",
"VTLANG_POWER_REBOOT": "Riavvia",
"VTLANG_POWER_HALT": "Arresta",
"VTLANG_POWER_BOOT_EFIFW": "Riavvia nel setup EFI",
"VTLANG_KEYBRD_LAYOUT": "Layout di tastiera",
"VTLANG_HWINFO": "Informazioni hardware",
"VTLANG_RESOLUTION_CFG": "Configurazione risoluzione",
"VTLANG_SCREEN_MODE": "Modalità display schermo",
"VTLANG_SCREEN_TEXT_MODE": "Forza modalità testuale",
"VTLANG_SCREEN_GUI_MODE": "Forza modalità grafica",
"VTLANG_THEME_SELECT": "Seleziona tema",
"VTLANG_UEFI_UTIL": "Utilità UEFI Ventoy UEFI Utilities",
"VTLANG_UTIL_SHOW_EFI_DRV": "Mostra driver EFI",
"VTLANG_UTIL_FIX_BLINIT_FAIL": "Correzione del fallimento di BlinitializeLibrary di Windows",
"VTLANG_JSON_CHK_JSON": "Controlla la configurazione json dei plugin (ventoy.json)",
"VTLANG_JSON_CHK_CONTROL": "Controlla il controllo globale della configurazione dei plugin",
"VTLANG_JSON_CHK_THEME": "Controlla il tema della configurazione dei plugin",
"VTLANG_JSON_CHK_AUTOINS": "Controlla l'installazione automatica della configurazione dei plugin",
"VTLANG_JSON_CHK_PERSIST": "Controlla la persistenza della configurazione dei plugin",
"VTLANG_JSON_CHK_MENU_ALIAS": "Controlla l'alias del menu della configurazione dei plugin",
"VTLANG_JSON_CHK_MENU_TIP": "Controlla il suggerimento del menu della configurazione dei plugin",
"VTLANG_JSON_CHK_MENU_CLASS": "Controlla la classe del menu della configurazione dei plugin",
"VTLANG_JSON_CHK_INJECTION": "Controlla l'injection della configurazione dei plugin",
"VTLANG_JSON_CHK_AUTO_MEMDISK": "Controlla il memdisk automatico della configurazione dei plugin",
"VTLANG_JSON_CHK_IMG_LIST": "Controlla la lista delle immagini della configurazione dei plugin",
"VTLANG_JSON_CHK_IMG_BLIST": "Controlla la lista nera delle immagini della configurazione dei plugin",
"VTLANG_JSON_CHK_CONF_REPLACE": "Controlla la sostituzione della configurazione di avvio della configurazione dei plugin",
"VTLANG_JSON_CHK_DUD": "Controlla dud della configurazione dei plugin",
"VTLANG_JSON_CHK_PASSWORD": "Controlla password della configurazione dei plugin",
"VTLANG_NORMAL_MODE": "Avvia in modalità normale",
"VTLANG_WIMBOOT_MODE": "Avvia in modalità wimboot",
"VTLANG_GRUB2_MODE": "Avvia in modalità grub2",
"VTLANG_MEMDISK_MODE": "Avvia in modalità memdisk",
"VTLANG_RET_TO_LISTVIEW": "Ritorna alla VistaLista",
"VTLANG_RET_TO_TREEVIEW": "Ritorna alla VistaAlbero",
"VTLANG_NO_AUTOINS_SCRIPT": "Avvia senza il modello di installazione automatica",
"VTLANG_AUTOINS_USE": "Avvia con",
"VTLANG_NO_PERSIST": "Avvia senza persistenza",
"VTLANG_PERSIST_USE": "Avvia con",
"VTLANG_BROWER_RETURN": "Ritorna",
"VTLANG_ENTER_EXIT": "premi il tasto Invio per uscire",
"VTLANG_ENTER_REBOOT": "premi il tasto Invio per riavviare",
"VTLANG_ENTER_CONTINUE": "premi il tasto Invio per continuare",
"VTLANG_CTRL_TEMP_SET": "Impostazioni controllo temporaneo",
"VTLANG_WIN11_BYPASS_CHECK": "Bypassa il controllo di CPU/TPM/SecureBoot durante l'installazione di Windows 11",
"VTLANG_WIN11_BYPASS_NRO": "Bypassa il requisito di un account online durante l'installazione di Windows 11",
"VTLANG_LINUX_REMOUNT": "Monta la partizione di Ventoy dopo l'avvio di Linux",
"VTLANG_SECONDARY_BOOT_MENU": "Mostra il menu di avvio secondario",
"MENU_STR_XXX": ""
}

@ -195,7 +195,7 @@ if [ "$MODE" = "install" -a -z "$NONDESTRUCTIVE" ]; then
fi
if [ "$PARTTOOL" = "parted" ]; then
if parted $DISK p | grep -i -q 'sector size.*4096.*4096'; then
if parted -s $DISK p 2>&1 | grep -i -q 'sector size.*4096.*4096'; then
vterr "Currently Ventoy does not support 4K native device."
exit 1
fi

@ -164,6 +164,13 @@ struct modversion_info {
char name[64 - sizeof(unsigned long)];
};
struct modversion_info2 {
/* Offset of the next modversion entry in relation to this one. */
uint32_t next;
uint32_t crc;
char name[0];
};
typedef struct ko_param
{
@ -294,14 +301,15 @@ static int vtoykmod_find_section32(char *buf, char *section, int *offset, int *l
return 1;
}
static int vtoykmod_update_modcrc(char *oldmodver, int oldcnt, char *newmodver, int newcnt)
static int vtoykmod_update_modcrc1(char *oldmodver, int oldcnt, char *newmodver, int newcnt)
{
int i, j;
struct modversion_info *pold, *pnew;
pold = (struct modversion_info *)oldmodver;
pnew = (struct modversion_info *)newmodver;
debug("module update modver format 1\n");
for (i = 0; i < oldcnt; i++)
{
for (j = 0; j < newcnt; j++)
@ -318,6 +326,51 @@ static int vtoykmod_update_modcrc(char *oldmodver, int oldcnt, char *newmodver,
return 0;
}
static int vtoykmod_update_modcrc2(char *oldmodver, int oldlen, char *newmodver, int newlen)
{
struct modversion_info2 *pold, *pnew, *pnewend;
pold = (struct modversion_info2 *)oldmodver;
pnew = (struct modversion_info2 *)newmodver;
pnewend = (struct modversion_info2 *)(newmodver + newlen);
debug("module update modver format 2\n");
/* here we think that there is only module_layout in oldmodver */
for (; pnew < pnewend && pnew->next; pnew = (struct modversion_info2 *)((char *)pnew + pnew->next))
{
if (strcmp(pnew->name, "module_layout") == 0)
{
debug("CRC 0x%08x --> 0x%08x %s\n", pold->crc, pnew->crc, pnew->name);
memset(pold, 0, oldlen);
pold->next = 0x18; /* 8 + module_layout align 8 */
pold->crc = pnew->crc;
strcpy(pold->name, pnew->name);
break;
}
}
return 0;
}
static int vtoykmod_update_modcrc(char *oldmodver, int oldlen, char *newmodver, int newlen)
{
uint32_t uiCrc = 0;
memcpy(&uiCrc, newmodver + 4, 4);
if (uiCrc > 0)
{
return vtoykmod_update_modcrc2(oldmodver, oldlen, newmodver, newlen);
}
else
{
return vtoykmod_update_modcrc1(oldmodver, oldlen / 64, newmodver, newlen / 64);
}
}
static int vtoykmod_update_vermagic(char *oldbuf, int oldsize, char *newbuf, int newsize, int *modver)
{
int i = 0;
@ -393,7 +446,7 @@ int vtoykmod_update(char *oldko, char *newko)
if (rc == 0)
{
vtoykmod_update_modcrc(oldbuf + oldoff, oldlen / 64, newbuf + newoff, newlen / 64);
vtoykmod_update_modcrc(oldbuf + oldoff, oldlen, newbuf + newoff, newlen);
}
}
else

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save