b16838c6 | 07-Jul-2020 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: trace functions in subdirectories of lib/
ccflags-remove-$(CONFIG_FUNCTION_TRACER) += $(CC_FLAGS_FTRACE)
exists here in sub-directories of lib/ to keep the behavior of commit 2464a609ded0 (
kbuild: trace functions in subdirectories of lib/
ccflags-remove-$(CONFIG_FUNCTION_TRACER) += $(CC_FLAGS_FTRACE)
exists here in sub-directories of lib/ to keep the behavior of commit 2464a609ded0 ("ftrace: do not trace library functions").
Since that commit, not only the objects in lib/ but also the ones in the sub-directories are excluded from ftrace (although the commit description did not explicitly mention this).
However, most of library functions in sub-directories are not so hot. Re-add them to ftrace.
Going forward, only the objects right under lib/ will be excluded.
Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
show more ...
|
270f7806 | 03-Jun-2020 |
Yannick Cote <ycote@redhat.com> |
selftests/livepatch: fix mem leaks in test-klp-shadow-vars
In some cases, when an error occurs during testing and the main test routine returns, a memory leak occurs via leaving previously registere
selftests/livepatch: fix mem leaks in test-klp-shadow-vars
In some cases, when an error occurs during testing and the main test routine returns, a memory leak occurs via leaving previously registered shadow variables allocated in the kernel as well as shadow_ptr list elements. From now on, in case of error, remove all allocated shadow variables and shadow_ptr struct elements.
Signed-off-by: Yannick Cote <ycote@redhat.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20200603182058.109470-5-ycote@redhat.com
show more ...
|
76efe6da | 03-Jun-2020 |
Yannick Cote <ycote@redhat.com> |
selftests/livepatch: more verification in test-klp-shadow-vars
This change makes the test feel more familiar with narrowing to a typical usage by operating on a number of identical structure instanc
selftests/livepatch: more verification in test-klp-shadow-vars
This change makes the test feel more familiar with narrowing to a typical usage by operating on a number of identical structure instances and populating the same two new shadow variables symmetrically while keeping the same testing and verification criteria for the extra variables.
Signed-off-by: Yannick Cote <ycote@redhat.com> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20200603182058.109470-4-ycote@redhat.com
show more ...
|
6a26a9df | 03-Jun-2020 |
Yannick Cote <ycote@redhat.com> |
selftests/livepatch: rework test-klp-shadow-vars
The initial idea was to make a change to please cppcheck and remove void pointer arithmetics found a few times:
portability: 'obj' is of type 'void
selftests/livepatch: rework test-klp-shadow-vars
The initial idea was to make a change to please cppcheck and remove void pointer arithmetics found a few times:
portability: 'obj' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
The rest of the changes are to help make the test read as an example while continuing to verify the shadow variable code. The logic of the test is unchanged but restructured to use descriptive names.
Signed-off-by: Yannick Cote <ycote@redhat.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20200603182058.109470-3-ycote@redhat.com
show more ...
|
be6da984 | 16-Jan-2020 |
Petr Mladek <pmladek@suse.com> |
livepatch/samples/selftest: Use klp_shadow_alloc() API correctly
The commit e91c2518a5d22a ("livepatch: Initialize shadow variables safely by a custom callback") leads to the following static checke
livepatch/samples/selftest: Use klp_shadow_alloc() API correctly
The commit e91c2518a5d22a ("livepatch: Initialize shadow variables safely by a custom callback") leads to the following static checker warning:
samples/livepatch/livepatch-shadow-fix1.c:86 livepatch_fix1_dummy_alloc() error: 'klp_shadow_alloc()' 'leak' too small (4 vs 8)
It is because klp_shadow_alloc() is used a wrong way:
int *leak; shadow_leak = klp_shadow_alloc(d, SV_LEAK, sizeof(leak), GFP_KERNEL, shadow_leak_ctor, leak);
The code is supposed to store the "leak" pointer into the shadow variable. 3rd parameter correctly passes size of the data (size of pointer). But the 5th parameter is wrong. It should pass pointer to the data (pointer to the pointer) but it passes the pointer directly.
It works because shadow_leak_ctor() handle "ctor_data" as the data instead of pointer to the data. But it is semantically wrong and confusing.
The same problem is also in the module used by selftests. In this case, "pvX" variables are introduced. They represent the data stored in the shadow variables.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
show more ...
|
49ee4dd2 | 04-Feb-2019 |
Petr Mladek <pmladek@suse.com> |
livepatch: Proper error handling in the shadow variables selftest
Add proper error handling when allocating or getting shadow variables in the selftest. It prevents an invalid pointer access in some
livepatch: Proper error handling in the shadow variables selftest
Add proper error handling when allocating or getting shadow variables in the selftest. It prevents an invalid pointer access in some situations. It shows the good programming practice in the others.
The error codes are just the best guess and specific for this particular test. In general, klp_shadow_alloc() returns NULL also when the given shadow variable has already been allocated. In addition, both klp_shadow_alloc() and klp_shadow_get_or_alloc() might fail from other reasons when the constructor fails.
Note, that the error code is not really important even in the real life. The use of shadow variables should be transparent for the original livepatched code.
Acked-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Petr Mladek <pmladek@suse.com>
show more ...
|