Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
712f10e8
Commit
712f10e8
authored
May 14, 2024
by
longpanda
Browse files
Fix VTOY_LINUX_REMOUNT feature in RHEL 9.4+ (#2827)
parent
2be340d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
30 deletions
+67
-30
DMPATCH/dmpatch.c
DMPATCH/dmpatch.c
+67
-30
IMG/cpio_x86/ventoy/tool/dm_patch_64.ko
IMG/cpio_x86/ventoy/tool/dm_patch_64.ko
+0
-0
IMG/cpio_x86/ventoy/tool/dm_patch_ibt_64.ko
IMG/cpio_x86/ventoy/tool/dm_patch_ibt_64.ko
+0
-0
No files found.
DMPATCH/dmpatch.c
View file @
712f10e8
...
...
@@ -451,39 +451,24 @@ static u64 notrace dmpatch_ibt_save(void) { return 0; }
static
void
notrace
dmpatch_ibt_restore
(
u64
save
)
{
(
void
)
save
;
}
#endif
static
int
notrace
dmpatch_
init
(
void
)
static
int
notrace
dmpatch_
process
(
unsigned
long
a
,
unsigned
long
b
,
unsigned
long
c
)
{
int
r
=
0
;
int
rc
=
0
;
u64
msr
=
0
;
if
(
g_ko_param
.
ibt
==
0x8888
)
{
msr
=
dmpatch_ibt_save
();
}
kprintf
=
(
printk_pf
)(
g_ko_param
.
printk_addr
);
unsigned
long
kv_major
=
0
;
unsigned
long
kv_minor
=
0
;
unsigned
long
kv_subminor
=
0
;
vdebug
(
"dmpatch_init start pagesize=%lu kernel=%lu.%lu.%lu ...
\n
"
,
g_ko_param
.
pgsize
,
g_ko_param
.
kv_major
,
g_ko_param
.
kv_minor
,
g_ko_param
.
kv_subminor
);
if
(
g_ko_param
.
struct_size
!=
sizeof
(
ko_param
))
{
vdebug
(
"Invalid struct size %d %d
\n
"
,
(
int
)
g_ko_param
.
struct_size
,
(
int
)
sizeof
(
ko_param
));
return
-
EINVAL
;
}
if
(
g_ko_param
.
sym_get_addr
==
0
||
g_ko_param
.
sym_put_addr
==
0
||
g_ko_param
.
ro_addr
==
0
||
g_ko_param
.
rw_addr
==
0
)
{
return
-
EINVAL
;
}
vdebug
(
"dmpatch_process as KV %d.%d.%d ...
\n
"
,
(
int
)
a
,
(
int
)
b
,
(
int
)
c
);
set_mem_ro
=
(
set_memory_attr_pf
)(
g_ko_param
.
ro_addr
);
set_mem_rw
=
(
set_memory_attr_pf
)(
g_ko_param
.
rw_addr
);
reg_kprobe
=
(
kprobe_reg_pf
)
g_ko_param
.
reg_kprobe_addr
;
unreg_kprobe
=
(
kprobe_unreg_pf
)
g_ko_param
.
unreg_kprobe_addr
;
kv_major
=
g_ko_param
.
kv_major
;
kv_minor
=
g_ko_param
.
kv_minor
;
kv_subminor
=
g_ko_param
.
kv_subminor
;
g_ko_param
.
kv_major
=
a
;
g_ko_param
.
kv_minor
=
b
;
g_ko_param
.
kv_subminor
=
c
;
if
(
dmpatch_kv_above
(
6
,
5
,
0
))
/* >= kernel 6.5 */
{
vdebug
(
"new interface patch dm_get_table_device...
\n
"
);
...
...
@@ -531,14 +516,66 @@ static int notrace dmpatch_init(void)
vdebug
(
"######## dm patch success ###########
\n
"
);
vdebug
(
"#####################################
\n
"
);
out:
g_ko_param
.
kv_major
=
kv_major
;
g_ko_param
.
kv_minor
=
kv_minor
;
g_ko_param
.
kv_subminor
=
kv_subminor
;
return
rc
;
}
static
int
notrace
dmpatch_init
(
void
)
{
int
rc
=
0
;
u64
msr
=
0
;
if
(
g_ko_param
.
ibt
==
0x8888
)
{
msr
=
dmpatch_ibt_save
();
}
kprintf
=
(
printk_pf
)(
g_ko_param
.
printk_addr
);
vdebug
(
"dmpatch_init start pagesize=%lu kernel=%lu.%lu.%lu ...
\n
"
,
g_ko_param
.
pgsize
,
g_ko_param
.
kv_major
,
g_ko_param
.
kv_minor
,
g_ko_param
.
kv_subminor
);
if
(
g_ko_param
.
struct_size
!=
sizeof
(
ko_param
))
{
vdebug
(
"Invalid struct size %d %d
\n
"
,
(
int
)
g_ko_param
.
struct_size
,
(
int
)
sizeof
(
ko_param
));
return
-
EINVAL
;
}
if
(
g_ko_param
.
sym_get_addr
==
0
||
g_ko_param
.
sym_put_addr
==
0
||
g_ko_param
.
ro_addr
==
0
||
g_ko_param
.
rw_addr
==
0
)
{
return
-
EINVAL
;
}
set_mem_ro
=
(
set_memory_attr_pf
)(
g_ko_param
.
ro_addr
);
set_mem_rw
=
(
set_memory_attr_pf
)(
g_ko_param
.
rw_addr
);
reg_kprobe
=
(
kprobe_reg_pf
)
g_ko_param
.
reg_kprobe_addr
;
unreg_kprobe
=
(
kprobe_unreg_pf
)
g_ko_param
.
unreg_kprobe_addr
;
rc
=
dmpatch_process
(
g_ko_param
.
kv_major
,
g_ko_param
.
kv_minor
,
g_ko_param
.
kv_subminor
);
if
(
rc
)
{
if
(
g_ko_param
.
kv_major
>=
5
)
{
rc
=
dmpatch_process
(
6
,
5
,
0
);
if
(
rc
)
{
rc
=
dmpatch_process
(
6
,
7
,
0
);
}
}
}
if
(
g_ko_param
.
ibt
==
0x8888
)
{
dmpatch_ibt_restore
(
msr
);
}
out:
return
rc
;
return
rc
;
}
static
void
notrace
dmpatch_exit
(
void
)
...
...
IMG/cpio_x86/ventoy/tool/dm_patch_64.ko
View file @
712f10e8
No preview for this file type
IMG/cpio_x86/ventoy/tool/dm_patch_ibt_64.ko
View file @
712f10e8
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment