Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
e7dbd4d5
Commit
e7dbd4d5
authored
Mar 28, 2022
by
Petr Mladek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-5.18/selftests-fixes' into for-linus
parents
29573083
5e6ded2e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
+23
-6
samples/livepatch/livepatch-shadow-fix1.c
samples/livepatch/livepatch-shadow-fix1.c
+1
-1
samples/livepatch/livepatch-shadow-fix2.c
samples/livepatch/livepatch-shadow-fix2.c
+1
-1
tools/testing/selftests/livepatch/functions.sh
tools/testing/selftests/livepatch/functions.sh
+19
-3
tools/testing/selftests/livepatch/test-ftrace.sh
tools/testing/selftests/livepatch/test-ftrace.sh
+2
-1
No files found.
samples/livepatch/livepatch-shadow-fix1.c
View file @
e7dbd4d5
...
...
@@ -109,9 +109,9 @@ static void livepatch_fix1_dummy_leak_dtor(void *obj, void *shadow_data)
void
*
d
=
obj
;
int
**
shadow_leak
=
shadow_data
;
kfree
(
*
shadow_leak
);
pr_info
(
"%s: dummy @ %p, prevented leak @ %p
\n
"
,
__func__
,
d
,
*
shadow_leak
);
kfree
(
*
shadow_leak
);
}
static
void
livepatch_fix1_dummy_free
(
struct
dummy
*
d
)
...
...
samples/livepatch/livepatch-shadow-fix2.c
View file @
e7dbd4d5
...
...
@@ -61,9 +61,9 @@ static void livepatch_fix2_dummy_leak_dtor(void *obj, void *shadow_data)
void
*
d
=
obj
;
int
**
shadow_leak
=
shadow_data
;
kfree
(
*
shadow_leak
);
pr_info
(
"%s: dummy @ %p, prevented leak @ %p
\n
"
,
__func__
,
d
,
*
shadow_leak
);
kfree
(
*
shadow_leak
);
}
static
void
livepatch_fix2_dummy_free
(
struct
dummy
*
d
)
...
...
tools/testing/selftests/livepatch/functions.sh
View file @
e7dbd4d5
...
...
@@ -75,9 +75,25 @@ function set_dynamic_debug() {
}
function
set_ftrace_enabled
()
{
result
=
$(
sysctl
-q
kernel.ftrace_enabled
=
"
$1
"
2>&1
&&
\
sysctl kernel.ftrace_enabled 2>&1
)
echo
"livepatch:
$result
"
>
/dev/kmsg
local
can_fail
=
0
if
[[
"
$1
"
==
"--fail"
]]
;
then
can_fail
=
1
shift
fi
local
err
=
$(
sysctl
-q
kernel.ftrace_enabled
=
"
$1
"
2>&1
)
local
result
=
$(
sysctl
--values
kernel.ftrace_enabled
)
if
[[
"
$result
"
!=
"
$1
"
]]
;
then
if
[[
$can_fail
-eq
1
]]
;
then
echo
"livepatch:
$err
"
>
/dev/kmsg
return
fi
skip
"failed to set kernel.ftrace_enabled =
$1
"
fi
echo
"livepatch: kernel.ftrace_enabled =
$result
"
>
/dev/kmsg
}
function
cleanup
()
{
...
...
tools/testing/selftests/livepatch/test-ftrace.sh
View file @
e7dbd4d5
...
...
@@ -25,7 +25,8 @@ if [[ "$(cat /proc/cmdline)" != "$MOD_LIVEPATCH: this has been live patched" ]]
die
"livepatch kselftest(s) failed"
fi
set_ftrace_enabled 0
# Check that ftrace could not get disabled when a livepatch is enabled
set_ftrace_enabled
--fail
0
if
[[
"
$(
cat
/proc/cmdline
)
"
!=
"
$MOD_LIVEPATCH
: this has been live patched"
]]
;
then
echo
-e
"FAIL
\n\n
"
die
"livepatch kselftest(s) failed"
...
...
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