<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/kernel/trace, branch v5.7-rc5</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Stop the ad-hoc games with -Wno-maybe-initialized</title>
<updated>2020-05-09T20:57:10+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-05-09T20:57:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=78a5255ffb6a1af189a83e493d916ba1c54d8c75'/>
<id>78a5255ffb6a1af189a83e493d916ba1c54d8c75</id>
<content type='text'>
We have some rather random rules about when we accept the
"maybe-initialized" warnings, and when we don't.

For example, we consider it unreliable for gcc versions &lt; 4.9, but also
if -O3 is enabled, or if optimizing for size.  And then various kernel
config options disabled it, because they know that they trigger that
warning by confusing gcc sufficiently (ie PROFILE_ALL_BRANCHES).

And now gcc-10 seems to be introducing a lot of those warnings too, so
it falls under the same heading as 4.9 did.

At the same time, we have a very straightforward way to _enable_ that
warning when wanted: use "W=2" to enable more warnings.

So stop playing these ad-hoc games, and just disable that warning by
default, with the known and straight-forward "if you want to work on the
extra compiler warnings, use W=123".

Would it be great to have code that is always so obvious that it never
confuses the compiler whether a variable is used initialized or not?
Yes, it would.  In a perfect world, the compilers would be smarter, and
our source code would be simpler.

That's currently not the world we live in, though.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have some rather random rules about when we accept the
"maybe-initialized" warnings, and when we don't.

For example, we consider it unreliable for gcc versions &lt; 4.9, but also
if -O3 is enabled, or if optimizing for size.  And then various kernel
config options disabled it, because they know that they trigger that
warning by confusing gcc sufficiently (ie PROFILE_ALL_BRANCHES).

And now gcc-10 seems to be introducing a lot of those warnings too, so
it falls under the same heading as 4.9 did.

At the same time, we have a very straightforward way to _enable_ that
warning when wanted: use "W=2" to enable more warnings.

So stop playing these ad-hoc games, and just disable that warning by
default, with the known and straight-forward "if you want to work on the
extra compiler warnings, use W=123".

Would it be great to have code that is always so obvious that it never
confuses the compiler whether a variable is used initialized or not?
Yes, it would.  In a perfect world, the compilers would be smarter, and
our source code would be simpler.

That's currently not the world we live in, though.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing: Make tracing_snapshot_instance_cond() static</title>
<updated>2020-05-07T17:32:58+00:00</updated>
<author>
<name>Zou Wei</name>
<email>zou_wei@huawei.com</email>
</author>
<published>2020-04-23T04:08:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=192b7993b3ff92b62b687e940e5e88fa0218d764'/>
<id>192b7993b3ff92b62b687e940e5e88fa0218d764</id>
<content type='text'>
Fix the following sparse warning:

kernel/trace/trace.c:950:6: warning: symbol 'tracing_snapshot_instance_cond'
was not declared. Should it be static?

Link: http://lkml.kernel.org/r/1587614905-48692-1-git-send-email-zou_wei@huawei.com

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Zou Wei &lt;zou_wei@huawei.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix the following sparse warning:

kernel/trace/trace.c:950:6: warning: symbol 'tracing_snapshot_instance_cond'
was not declared. Should it be static?

Link: http://lkml.kernel.org/r/1587614905-48692-1-git-send-email-zou_wei@huawei.com

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Zou Wei &lt;zou_wei@huawei.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing: Add a vmalloc_sync_mappings() for safe measure</title>
<updated>2020-05-07T17:32:57+00:00</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2020-05-06T14:36:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=11f5efc3ab66284f7aaacc926e9351d658e2577b'/>
<id>11f5efc3ab66284f7aaacc926e9351d658e2577b</id>
<content type='text'>
x86_64 lazily maps in the vmalloc pages, and the way this works with per_cpu
areas can be complex, to say the least. Mappings may happen at boot up, and
if nothing synchronizes the page tables, those page mappings may not be
synced till they are used. This causes issues for anything that might touch
one of those mappings in the path of the page fault handler. When one of
those unmapped mappings is touched in the page fault handler, it will cause
another page fault, which in turn will cause a page fault, and leave us in
a loop of page faults.

Commit 763802b53a42 ("x86/mm: split vmalloc_sync_all()") split
vmalloc_sync_all() into vmalloc_sync_unmappings() and
vmalloc_sync_mappings(), as on system exit, it did not need to do a full
sync on x86_64 (although it still needed to be done on x86_32). By chance,
the vmalloc_sync_all() would synchronize the page mappings done at boot up
and prevent the per cpu area from being a problem for tracing in the page
fault handler. But when that synchronization in the exit of a task became a
nop, it caused the problem to appear.

Link: https://lore.kernel.org/r/20200429054857.66e8e333@oasis.local.home

Cc: stable@vger.kernel.org
Fixes: 737223fbca3b1 ("tracing: Consolidate buffer allocation code")
Reported-by: "Tzvetomir Stoyanov (VMware)" &lt;tz.stoyanov@gmail.com&gt;
Suggested-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
x86_64 lazily maps in the vmalloc pages, and the way this works with per_cpu
areas can be complex, to say the least. Mappings may happen at boot up, and
if nothing synchronizes the page tables, those page mappings may not be
synced till they are used. This causes issues for anything that might touch
one of those mappings in the path of the page fault handler. When one of
those unmapped mappings is touched in the page fault handler, it will cause
another page fault, which in turn will cause a page fault, and leave us in
a loop of page faults.

Commit 763802b53a42 ("x86/mm: split vmalloc_sync_all()") split
vmalloc_sync_all() into vmalloc_sync_unmappings() and
vmalloc_sync_mappings(), as on system exit, it did not need to do a full
sync on x86_64 (although it still needed to be done on x86_32). By chance,
the vmalloc_sync_all() would synchronize the page mappings done at boot up
and prevent the per cpu area from being a problem for tracing in the page
fault handler. But when that synchronization in the exit of a task became a
nop, it caused the problem to appear.

Link: https://lore.kernel.org/r/20200429054857.66e8e333@oasis.local.home

Cc: stable@vger.kernel.org
Fixes: 737223fbca3b1 ("tracing: Consolidate buffer allocation code")
Reported-by: "Tzvetomir Stoyanov (VMware)" &lt;tz.stoyanov@gmail.com&gt;
Suggested-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing: Wait for preempt irq delay thread to finish</title>
<updated>2020-05-07T17:32:40+00:00</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2020-05-06T14:20:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d16a8c31077e75ecb9427fbfea59b74eed00f698'/>
<id>d16a8c31077e75ecb9427fbfea59b74eed00f698</id>
<content type='text'>
Running on a slower machine, it is possible that the preempt delay kernel
thread may still be executing if the module was immediately removed after
added, and this can cause the kernel to crash as the kernel thread might be
executing after its code has been removed.

There's no reason that the caller of the code shouldn't just wait for the
delay thread to finish, as the thread can also be created by a trigger in
the sysfs code, which also has the same issues.

Link: http://lore.kernel.org/r/5EA2B0C8.2080706@cn.fujitsu.com

Cc: stable@vger.kernel.org
Fixes: 793937236d1ee ("lib: Add module for testing preemptoff/irqsoff latency tracers")
Reported-by: Xiao Yang &lt;yangx.jy@cn.fujitsu.com&gt;
Reviewed-by: Xiao Yang &lt;yangx.jy@cn.fujitsu.com&gt;
Reviewed-by: Joel Fernandes &lt;joel@joelfernandes.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Running on a slower machine, it is possible that the preempt delay kernel
thread may still be executing if the module was immediately removed after
added, and this can cause the kernel to crash as the kernel thread might be
executing after its code has been removed.

There's no reason that the caller of the code shouldn't just wait for the
delay thread to finish, as the thread can also be created by a trigger in
the sysfs code, which also has the same issues.

Link: http://lore.kernel.org/r/5EA2B0C8.2080706@cn.fujitsu.com

Cc: stable@vger.kernel.org
Fixes: 793937236d1ee ("lib: Add module for testing preemptoff/irqsoff latency tracers")
Reported-by: Xiao Yang &lt;yangx.jy@cn.fujitsu.com&gt;
Reviewed-by: Xiao Yang &lt;yangx.jy@cn.fujitsu.com&gt;
Reviewed-by: Joel Fernandes &lt;joel@joelfernandes.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing/kprobes: Reject new event if loc is NULL</title>
<updated>2020-05-06T13:04:11+00:00</updated>
<author>
<name>Masami Hiramatsu</name>
<email>mhiramat@kernel.org</email>
</author>
<published>2020-04-25T05:49:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5b4dcd2d201a395ad4054067bfae4a07554fbd65'/>
<id>5b4dcd2d201a395ad4054067bfae4a07554fbd65</id>
<content type='text'>
Reject the new event which has NULL location for kprobes.
For kprobes, user must specify at least the location.

Link: http://lkml.kernel.org/r/158779376597.6082.1411212055469099461.stgit@devnote2

Cc: Tom Zanussi &lt;zanussi@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Fixes: 2a588dd1d5d6 ("tracing: Add kprobe event command generation functions")
Signed-off-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reject the new event which has NULL location for kprobes.
For kprobes, user must specify at least the location.

Link: http://lkml.kernel.org/r/158779376597.6082.1411212055469099461.stgit@devnote2

Cc: Tom Zanussi &lt;zanussi@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Fixes: 2a588dd1d5d6 ("tracing: Add kprobe event command generation functions")
Signed-off-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing/boottime: Fix kprobe event API usage</title>
<updated>2020-05-06T13:04:11+00:00</updated>
<author>
<name>Masami Hiramatsu</name>
<email>mhiramat@kernel.org</email>
</author>
<published>2020-04-25T05:49:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=da0f1f4167e3af69e1d8b32d6d65195ddd2bfb64'/>
<id>da0f1f4167e3af69e1d8b32d6d65195ddd2bfb64</id>
<content type='text'>
Fix boottime kprobe events to use API correctly for
multiple events.

For example, when we set a multiprobe kprobe events in
bootconfig like below,

  ftrace.event.kprobes.myevent {
  	probes = "vfs_read $arg1 $arg2", "vfs_write $arg1 $arg2"
  }

This cause an error;

  trace_boot: Failed to add probe: p:kprobes/myevent (null)  vfs_read $arg1 $arg2  vfs_write $arg1 $arg2

This shows the 1st argument becomes NULL and multiprobes
are merged to 1 probe.

Link: http://lkml.kernel.org/r/158779375766.6082.201939936008972838.stgit@devnote2

Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Fixes: 29a154810546 ("tracing: Change trace_boot to use kprobe_event interface")
Reviewed-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix boottime kprobe events to use API correctly for
multiple events.

For example, when we set a multiprobe kprobe events in
bootconfig like below,

  ftrace.event.kprobes.myevent {
  	probes = "vfs_read $arg1 $arg2", "vfs_write $arg1 $arg2"
  }

This cause an error;

  trace_boot: Failed to add probe: p:kprobes/myevent (null)  vfs_read $arg1 $arg2  vfs_write $arg1 $arg2

This shows the 1st argument becomes NULL and multiprobes
are merged to 1 probe.

Link: http://lkml.kernel.org/r/158779375766.6082.201939936008972838.stgit@devnote2

Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Fixes: 29a154810546 ("tracing: Change trace_boot to use kprobe_event interface")
Reviewed-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing/kprobes: Fix a double initialization typo</title>
<updated>2020-05-06T13:04:11+00:00</updated>
<author>
<name>Masami Hiramatsu</name>
<email>mhiramat@kernel.org</email>
</author>
<published>2020-04-25T05:49:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=dcbd21c9fca5e954fd4e3d91884907eb6d47187e'/>
<id>dcbd21c9fca5e954fd4e3d91884907eb6d47187e</id>
<content type='text'>
Fix a typo that resulted in an unnecessary double
initialization to addr.

Link: http://lkml.kernel.org/r/158779374968.6082.2337484008464939919.stgit@devnote2

Cc: Tom Zanussi &lt;zanussi@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Fixes: c7411a1a126f ("tracing/kprobe: Check whether the non-suffixed symbol is notrace")
Signed-off-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a typo that resulted in an unnecessary double
initialization to addr.

Link: http://lkml.kernel.org/r/158779374968.6082.2337484008464939919.stgit@devnote2

Cc: Tom Zanussi &lt;zanussi@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Fixes: c7411a1a126f ("tracing/kprobe: Check whether the non-suffixed symbol is notrace")
Signed-off-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing: Convert local functions in tracing_map.c to static</title>
<updated>2020-04-23T02:07:26+00:00</updated>
<author>
<name>Jason Yan</name>
<email>yanaijie@huawei.com</email>
</author>
<published>2020-04-10T07:33:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d013496f99c5608e0f80afd67acb1ba93c4144ea'/>
<id>d013496f99c5608e0f80afd67acb1ba93c4144ea</id>
<content type='text'>
Fix the following sparse warning:

kernel/trace/tracing_map.c:286:6: warning: symbol
'tracing_map_array_clear' was not declared. Should it be static?
kernel/trace/tracing_map.c:297:6: warning: symbol
'tracing_map_array_free' was not declared. Should it be static?
kernel/trace/tracing_map.c:319:26: warning: symbol
'tracing_map_array_alloc' was not declared. Should it be static?

Link: http://lkml.kernel.org/r/20200410073312.38855-1-yanaijie@huawei.com

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Jason Yan &lt;yanaijie@huawei.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix the following sparse warning:

kernel/trace/tracing_map.c:286:6: warning: symbol
'tracing_map_array_clear' was not declared. Should it be static?
kernel/trace/tracing_map.c:297:6: warning: symbol
'tracing_map_array_free' was not declared. Should it be static?
kernel/trace/tracing_map.c:319:26: warning: symbol
'tracing_map_array_alloc' was not declared. Should it be static?

Link: http://lkml.kernel.org/r/20200410073312.38855-1-yanaijie@huawei.com

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Jason Yan &lt;yanaijie@huawei.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ftrace: Fix memory leak caused by not freeing entry in unregister_ftrace_direct()</title>
<updated>2020-04-23T02:04:27+00:00</updated>
<author>
<name>Steven Rostedt (VMware)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2020-04-23T01:38:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=353da87921a5ec654e7e9024e083f099f1b33c97'/>
<id>353da87921a5ec654e7e9024e083f099f1b33c97</id>
<content type='text'>
kmemleak reported the following:

unreferenced object 0xffff90d47127a920 (size 32):
  comm "modprobe", pid 1766, jiffies 4294792031 (age 162.568s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 22 01 00 00 00 00 ad de  ........".......
    00 78 12 a7 ff ff ff ff 00 00 b6 c0 ff ff ff ff  .x..............
  backtrace:
    [&lt;00000000bb79e72e&gt;] register_ftrace_direct+0xcb/0x3a0
    [&lt;00000000295e4f79&gt;] do_one_initcall+0x72/0x340
    [&lt;00000000873ead18&gt;] do_init_module+0x5a/0x220
    [&lt;00000000974d9de5&gt;] load_module+0x2235/0x2550
    [&lt;0000000059c3d6ce&gt;] __do_sys_finit_module+0xc0/0x120
    [&lt;000000005a8611b4&gt;] do_syscall_64+0x60/0x230
    [&lt;00000000a0cdc49e&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xb3

The entry used to save the direct descriptor needs to be freed
when unregistering.

Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
kmemleak reported the following:

unreferenced object 0xffff90d47127a920 (size 32):
  comm "modprobe", pid 1766, jiffies 4294792031 (age 162.568s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 22 01 00 00 00 00 ad de  ........".......
    00 78 12 a7 ff ff ff ff 00 00 b6 c0 ff ff ff ff  .x..............
  backtrace:
    [&lt;00000000bb79e72e&gt;] register_ftrace_direct+0xcb/0x3a0
    [&lt;00000000295e4f79&gt;] do_one_initcall+0x72/0x340
    [&lt;00000000873ead18&gt;] do_init_module+0x5a/0x220
    [&lt;00000000974d9de5&gt;] load_module+0x2235/0x2550
    [&lt;0000000059c3d6ce&gt;] __do_sys_finit_module+0xc0/0x120
    [&lt;000000005a8611b4&gt;] do_syscall_64+0x60/0x230
    [&lt;00000000a0cdc49e&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xb3

The entry used to save the direct descriptor needs to be freed
when unregistering.

Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tracing: Fix memory leaks in trace_events_hist.c</title>
<updated>2020-04-23T01:24:00+00:00</updated>
<author>
<name>Vamshi K Sthambamkadi</name>
<email>vamshi.k.sthambamkadi@gmail.com</email>
</author>
<published>2020-04-22T06:15:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9da73974eb9c965dd9989befb593b8c8da9e4bdc'/>
<id>9da73974eb9c965dd9989befb593b8c8da9e4bdc</id>
<content type='text'>
kmemleak report 1:
    [&lt;9092c50b&gt;] kmem_cache_alloc_trace+0x138/0x270
    [&lt;05a2c9ed&gt;] create_field_var+0xcf/0x180
    [&lt;528a2d68&gt;] action_create+0xe2/0xc80
    [&lt;63f50b61&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;28ea5d3d&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;3138e86f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;ffd66c19&gt;] __vfs_write+0x30/0x200
    [&lt;4f424a0d&gt;] vfs_write+0x96/0x1b0
    [&lt;da59a290&gt;] ksys_write+0x53/0xc0
    [&lt;3717101a&gt;] __ia32_sys_write+0x15/0x20
    [&lt;c5f23497&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;46e2629c&gt;] entry_SYSENTER_32+0xaf/0x102

This is because save_vars[] of struct hist_trigger_data are
not destroyed

kmemleak report 2:
    [&lt;9092c50b&gt;] kmem_cache_alloc_trace+0x138/0x270
    [&lt;6e5e97c5&gt;] create_var+0x3c/0x110
    [&lt;de82f1b9&gt;] create_field_var+0xaf/0x180
    [&lt;528a2d68&gt;] action_create+0xe2/0xc80
    [&lt;63f50b61&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;28ea5d3d&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;3138e86f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;ffd66c19&gt;] __vfs_write+0x30/0x200
    [&lt;4f424a0d&gt;] vfs_write+0x96/0x1b0
    [&lt;da59a290&gt;] ksys_write+0x53/0xc0
    [&lt;3717101a&gt;] __ia32_sys_write+0x15/0x20
    [&lt;c5f23497&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;46e2629c&gt;] entry_SYSENTER_32+0xaf/0x102

struct hist_field allocated through create_var() do not initialize
"ref" field to 1. The code in __destroy_hist_field() does not destroy
object if "ref" is initialized to zero, the condition
if (--hist_field-&gt;ref &gt; 1) always passes since unsigned int wraps.

kmemleak report 3:
    [&lt;f8666fcc&gt;] __kmalloc_track_caller+0x139/0x2b0
    [&lt;bb7f80a5&gt;] kstrdup+0x27/0x50
    [&lt;39d70006&gt;] init_var_ref+0x58/0xd0
    [&lt;8ca76370&gt;] create_var_ref+0x89/0xe0
    [&lt;f045fc39&gt;] action_create+0x38f/0xc80
    [&lt;7c146821&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;07de3f61&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;e87daf8f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;19bf1512&gt;] __vfs_write+0x30/0x200
    [&lt;64ce4d27&gt;] vfs_write+0x96/0x1b0
    [&lt;a6f34170&gt;] ksys_write+0x53/0xc0
    [&lt;7d4230cd&gt;] __ia32_sys_write+0x15/0x20
    [&lt;8eadca00&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;235cf985&gt;] entry_SYSENTER_32+0xaf/0x102

hist_fields (system &amp; event_name) are not freed

Link: http://lkml.kernel.org/r/20200422061503.GA5151@cosmos

Signed-off-by: Vamshi K Sthambamkadi &lt;vamshi.k.sthambamkadi@gmail.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
kmemleak report 1:
    [&lt;9092c50b&gt;] kmem_cache_alloc_trace+0x138/0x270
    [&lt;05a2c9ed&gt;] create_field_var+0xcf/0x180
    [&lt;528a2d68&gt;] action_create+0xe2/0xc80
    [&lt;63f50b61&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;28ea5d3d&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;3138e86f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;ffd66c19&gt;] __vfs_write+0x30/0x200
    [&lt;4f424a0d&gt;] vfs_write+0x96/0x1b0
    [&lt;da59a290&gt;] ksys_write+0x53/0xc0
    [&lt;3717101a&gt;] __ia32_sys_write+0x15/0x20
    [&lt;c5f23497&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;46e2629c&gt;] entry_SYSENTER_32+0xaf/0x102

This is because save_vars[] of struct hist_trigger_data are
not destroyed

kmemleak report 2:
    [&lt;9092c50b&gt;] kmem_cache_alloc_trace+0x138/0x270
    [&lt;6e5e97c5&gt;] create_var+0x3c/0x110
    [&lt;de82f1b9&gt;] create_field_var+0xaf/0x180
    [&lt;528a2d68&gt;] action_create+0xe2/0xc80
    [&lt;63f50b61&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;28ea5d3d&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;3138e86f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;ffd66c19&gt;] __vfs_write+0x30/0x200
    [&lt;4f424a0d&gt;] vfs_write+0x96/0x1b0
    [&lt;da59a290&gt;] ksys_write+0x53/0xc0
    [&lt;3717101a&gt;] __ia32_sys_write+0x15/0x20
    [&lt;c5f23497&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;46e2629c&gt;] entry_SYSENTER_32+0xaf/0x102

struct hist_field allocated through create_var() do not initialize
"ref" field to 1. The code in __destroy_hist_field() does not destroy
object if "ref" is initialized to zero, the condition
if (--hist_field-&gt;ref &gt; 1) always passes since unsigned int wraps.

kmemleak report 3:
    [&lt;f8666fcc&gt;] __kmalloc_track_caller+0x139/0x2b0
    [&lt;bb7f80a5&gt;] kstrdup+0x27/0x50
    [&lt;39d70006&gt;] init_var_ref+0x58/0xd0
    [&lt;8ca76370&gt;] create_var_ref+0x89/0xe0
    [&lt;f045fc39&gt;] action_create+0x38f/0xc80
    [&lt;7c146821&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;07de3f61&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;e87daf8f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;19bf1512&gt;] __vfs_write+0x30/0x200
    [&lt;64ce4d27&gt;] vfs_write+0x96/0x1b0
    [&lt;a6f34170&gt;] ksys_write+0x53/0xc0
    [&lt;7d4230cd&gt;] __ia32_sys_write+0x15/0x20
    [&lt;8eadca00&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;235cf985&gt;] entry_SYSENTER_32+0xaf/0x102

hist_fields (system &amp; event_name) are not freed

Link: http://lkml.kernel.org/r/20200422061503.GA5151@cosmos

Signed-off-by: Vamshi K Sthambamkadi &lt;vamshi.k.sthambamkadi@gmail.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
