many
entries were skipped in the loop that reset every cpu buffer, so add
cond_resched() to avoid it.
Suggested-by: Steven Rostedt
Signed-off-by: Zheng Yejian
---
kernel/trace/trace.c | 2 ++
1 file changed, 2 insertions(+)
v2:
- Change to add cond_resched() in tracing_iter_reset()
Link
On 2024/8/26 22:35, Steven Rostedt wrote:
On Sat, 24 Aug 2024 11:03:43 +0800
Zheng Yejian wrote:
In __tracing_open(), when max latency tracers took place on the cpu,
the time start of its buffer would be updated, then event entries with
timestamps being earlier than start of the buffer would
On 2024/8/25 23:05, Masami Hiramatsu (Google) wrote:
On Sat, 24 Aug 2024 11:03:43 +0800
Zheng Yejian wrote:
In __tracing_open(), when max latency tracers took place on the cpu,
the time start of its buffer would be updated, then event entries with
timestamps being earlier than start of the
many
entries were skipped in the loop that reset every cpu buffer, so add
cond_resched() to avoid it.
Signed-off-by: Zheng Yejian
---
kernel/trace/trace.c | 9 +
1 file changed, 9 insertions(+)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ebe7ce2f5f4a..88faa95b457b
-by: Peter Zijlstra
Suggested-by: Masahiro Yamada
Signed-off-by: Zheng Yejian
---
scripts/kallsyms.c | 94 +++--
scripts/link-vmlinux.sh | 4 +-
scripts/mksysmap| 2 +-
3 files changed, 94 insertions(+), 6 deletions(-)
diff --git a/scripts/kallsyms.c
quot;)
Signed-off-by: Zheng Yejian
---
kernel/trace/ftrace.c | 18 +-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index fff5d3466c41..6947be8801d9 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -708
will
find module of the passed address first, but as ftrace_process_locs() is
called, the module has not been fully loaded, so those lookup functions
can not work.
Fixes: aebfd12521d9 ("x86/ibt,ftrace: Search for __fentry__ location")
Signed-off-by: Zheng Yejian
---
include/linu
9181f7c690 ("ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid
adding weak function")
2. commit 7af82ff90a2b ("powerpc/ftrace: Ignore weak functions")
3. commit f6834c8c59a8 ("powerpc/ftrace: Fix dropping weak symbols with
older toolchains")
Signed-off-by: Zheng Yejian
issue, check that given address is within the size of
the function found.
Signed-off-by: Zheng Yejian
---
include/linux/module.h | 7 +++
kernel/module/kallsyms.c | 19 +--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/include/linux/module.h b/include/linux
ll/cak7lnarir5z9hprg932t7yjrwqkx_qz7wkmbxx7ito2w5yj...@mail.gmail.com/
- Changes in PATCH 3/5:
- Now name of hole symbol is NULL, so if __fentry__ is located in a hole,
kallsyms_lookup() find an NULL name then will return 0, so drop the
needless kallsyms_is_hole_symbol().
Zheng Yejia
On 2024/7/20 22:14, Masahiro Yamada wrote:
On Thu, Jul 18, 2024 at 12:45 PM Zheng Yejian wrote:
On 2024/7/16 16:33, Masahiro Yamada wrote:
On Thu, Jun 13, 2024 at 10:36 PM Zheng Yejian wrote:
When a weak type function is overridden, its symbol will be removed
from the symbol table, but
On 2024/7/16 16:33, Masahiro Yamada wrote:
On Thu, Jun 13, 2024 at 10:36 PM Zheng Yejian wrote:
When a weak type function is overridden, its symbol will be removed
from the symbol table, but its code will not be removed. Besides,
due to lacking of size for kallsyms, kernel compute function
9181f7c690 ("ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid
adding weak function")
2. commit 7af82ff90a2b ("powerpc/ftrace: Ignore weak functions")
3. commit f6834c8c59a8 ("powerpc/ftrace: Fix dropping weak symbols with
older toolchains")
Signed-off-by: Zheng Yejian
issue, check that an given address is within the size of
the function found.
Signed-off-by: Zheng Yejian
---
include/linux/module.h | 7 +++
kernel/module/kallsyms.c | 19 +--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/include/linux/module.h b/include
quot;)
Signed-off-by: Zheng Yejian
---
kernel/trace/ftrace.c | 18 +-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0e8628e4d296..c46c35ac9b42 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -657
hat
the expansion is generally 10+ times.
As an optimization, introduce linked list 'sym_list' to associate and
count all symbols, then store them into 'table' at one time.
Signed-off-by: Zheng Yejian
---
scripts/kallsyms.c | 33 -
1 file changed,
_MAX_OFFSET
solution, also two related definition for powerpc.
[1]
https://lore.kernel.org/all/20240607150228.gr8...@noisy.programming.kicks-ass.net/
[2]
https://lore.kernel.org/all/20240611092157.gu40...@noisy.programming.kicks-ass.net/
Zheng Yejian (6):
kallsyms: Optimize multiple times of real
not work.
Fixes: aebfd12521d9 ("x86/ibt,ftrace: Search for __fentry__ location")
Signed-off-by: Zheng Yejian
---
include/linux/kallsyms.h | 13 +
include/linux/module.h | 7 +++
kernel/module/kallsyms.c | 23 +--
kernel/trace/ftrace.c| 15 +++
fs_context
Suggested-by: Peter Zijlstra
Signed-off-by: Zheng Yejian
---
scripts/kallsyms.c | 101 +++-
scripts/link-vmlinux.sh | 4 +-
scripts/mksysmap| 2 +-
3 files changed, 102 insertions(+), 5 deletions(-)
diff --git a/scripts/kallsyms.c
On 2024/6/11 17:21, Peter Zijlstra wrote:
On Tue, Jun 11, 2024 at 09:56:51AM +0800, Zheng Yejian wrote:
On 2024/6/7 23:02, Peter Zijlstra wrote:
Oh gawd, sodding weak functions again.
I would suggest changing scipts/kallsyms.c to emit readily identifiable
symbol names for all the weak junk
On 2024/6/7 23:02, Peter Zijlstra wrote:
On Fri, Jun 07, 2024 at 07:52:11PM +0800, Zheng Yejian wrote:
ftrace_location() was changed to not only return the __fentry__ location
when called for the __fentry__ location, but also when called for the
sym+0 location after commit aebfd12521d9 (&quo
f every record in __mount_loc table will
slow down system boot and module load.
Solution 1 and 2 need every arch to handle the complex fentry location
case, I use solution 3 as RFC.
Fixes: aebfd12521d9 ("x86/ibt,ftrace: Search for __fentry__ location")
Signed-off-by: Zheng Yejian
---
i
()/ftrace_free_mem().
Fixes: ae6aa16fdc16 ("kprobes: introduce ftrace based optimization")
Suggested-by: Steven Rostedt
Signed-off-by: Zheng Yejian
---
kernel/trace/ftrace.c | 39 +++
1 file changed, 23 insertions(+), 16 deletions(-)
v4:
- Simp
On 2024/5/3 05:07, Steven Rostedt wrote:
On Wed, 17 Apr 2024 11:28:30 +0800
Zheng Yejian wrote:
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index da1710499698..e05d3e3dc06a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1581,7 +1581,7 @@ static struct
()/ftrace_free_mem().
Fixes: ae6aa16fdc16 ("kprobes: introduce ftrace based optimization")
Suggested-by: Steven Rostedt
Signed-off-by: Zheng Yejian
---
kernel/trace/ftrace.c | 46 ---
1 file changed, 30 insertions(+), 16 deletions(-)
v3:
- Co
, and call
synchronize_rcu() before freeing any ftrace pages.
Fixes: ae6aa16fdc16 ("kprobes: introduce ftrace based optimization")
Signed-off-by: Zheng Yejian
---
kernel/trace/ftrace.c | 43 +++
1 file changed, 27 insertions(+), 16 deletions(-)
v2:
On 2024/4/10 23:28, Steven Rostedt wrote:
On Mon, 1 Apr 2024 20:55:43 +0800
Zheng Yejian wrote:
KASAN reports a bug:
BUG: KASAN: use-after-free in ftrace_location+0x90/0x120
Read of size 8 at addr 888141d40010 by task insmod/424
CPU: 8 PID: 424 Comm: insmod Tainted: GW
text_address()`
and `__module_text_address()`, but use only `__module_text_address()`
once and do `try_module_get(module)` which is only available with
MODULE_STATE_LIVE.
Signed-off-by: Zheng Yejian
---
kernel/kprobes.c | 18 --
1 file changed, 12 insertions(+), 6 deletions(-)
v
On 2024/4/9 21:49, Masami Hiramatsu (Google) wrote:
On Tue, 9 Apr 2024 14:20:45 +0800
Zheng Yejian wrote:
On 2024/4/8 20:41, Masami Hiramatsu (Google) wrote:
Hi Zheng,
On Mon, 8 Apr 2024 16:34:03 +0800
Zheng Yejian wrote:
There is once warn in __arm_kprobe_ftrace() on:
ret
On 2024/4/8 20:41, Masami Hiramatsu (Google) wrote:
Hi Zheng,
On Mon, 8 Apr 2024 16:34:03 +0800
Zheng Yejian wrote:
There is once warn in __arm_kprobe_ftrace() on:
ret = ftrace_set_filter_ip(ops, (unsigned long)p->addr, 0, 0);
if (WARN_ONCE(..., "Failed to arm kprobe-ftrac
d long) p->addr)) { // check again!
ret = -EINVAL;
goto out;
}
Signed-off-by: Zheng Yejian
---
kernel/kprobes.c | 18 --
1 file changed, 12 insertions(+), 6 deletions(-)
v2:
- Update commit messages and comments as suggested by Masami.
Link:
https://l
On 2024/4/8 10:50, Masami Hiramatsu (Google) wrote:
On Sun, 7 Apr 2024 11:59:04 +0800
Zheng Yejian wrote:
There is once warn in __arm_kprobe_ftrace() on:
ret = ftrace_set_filter_ip(ops, (unsigned long)p->addr, 0, 0);
if (WARN_ONCE(..., "Failed to arm kprobe-ftrace at %pS (err
d_mod is NULL, but then
//the return value would still be 0 !!!
*probed_mod = __module_text_address((unsigned long) p->addr);
...
}
So adjust the module text check to fix it.
Signed-off-by: Zheng Yejian
---
kernel/kprobes.c | 13 +
1 file changed, 9 insertions(+),
records in
ftrace_location(), so is ftrace_location_range().
Fixes: ae6aa16fdc16 ("kprobes: introduce ftrace based optimization")
Signed-off-by: Zheng Yejian
---
kernel/trace/ftrace.c | 28 ++--
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/ke
mon.constprop.0+0xb0/0x280
do_el0_svc+0x44/0x60
el0_svc+0x34/0x68
el0t_64_sync_handler+0xb8/0xc0
el0t_64_sync+0x168/0x170
Suggested-by: Steven Rostedt
Signed-off-by: Zheng Yejian
---
kernel/trace/trace.c | 6 ++
kernel/trace/trace.h | 1 +
kernel/trace/trace_ev
mon.constprop.0+0xb0/0x280
do_el0_svc+0x44/0x60
el0_svc+0x34/0x68
el0t_64_sync_handler+0xb8/0xc0
el0t_64_sync+0x168/0x170
Suggested-by: Steven Rostedt
Signed-off-by: Zheng Yejian
---
kernel/trace/trace_events_hist.c | 18 ++
1 file changed, 14 insertions(+), 4 deletions(-)
4/0x68
el0t_64_sync_handler+0xb8/0xc0
el0t_64_sync+0x168/0x170
Signed-off-by: Zheng Yejian
---
kernel/trace/trace_events_hist.c | 12
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 1abc07fba1b9
nting for
page-based read/remove/overrun.
Also correct the comments of ring_buffer_bytes_cpu() in this patch.
Fixes: c64e148a3be3 ("trace: Add ring buffer stats to measure rate of events")
Signed-off-by: Zheng Yejian
---
kernel/trace/ring_buffer.c | 28 +++-
1 fi
Without the newline character, the log may not be printed immediately
after the error occurs.
Fixes: ca376a937486 ("livepatch: Prevent module-specific KLP rela sections from
referencing vmlinux symbols")
Signed-off-by: Zheng Yejian
---
kernel/livepatch/core.c | 2 +-
1 file
Changelog for 'v2':
Complete commit messages with needed git commit ids as Greg and Lee suggested.
Lee sent a patchset to update Futex for v4.9, see
https://www.spinics.net/lists/stable/msg443081.html,
Then Xiaoming sent a follow-up patch for it, see
https://lore.kernel.org/lkml/20210225093120
4409 ("futex: Provide distinct return value when owner is exiting")
... and is the correct fix for this issue.
Fixes: 9c3f39860367 ("futex: Cure exit race")
Cc: sta...@vger.kernel.org # v4.9.258
Signed-off-by: Xiaoming Ni
Reviewed-by: Lee Jones
Signed-off-by: Greg Kroah-Hartman
Si
")]
Signed-off-by: Lee Jones
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Zheng Yejian
---
kernel/futex.c | 71 +-
1 file changed, 65 insertions(+), 6 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index b410752f5ad1..116766ef7de6
evious futex back-port attempt]
Signed-off-by: Lee Jones
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Zheng Yejian
---
kernel/futex.c | 138 +++--
1 file changed, 112 insertions(+), 26 deletions(-)
diff --git a/kernel/futex.c b/kernel/f
oah-Hartman
[Lee: Required to satisfy functional dependency from futex back-port.
Re-add the missing handle_exit_race() parts from:
3d4775df0a89 ("futex: Replace PF_EXITPIDONE with a state")]
Signed-off-by: Lee Jones
Signed-off-by: Greg Kroah-Hartman
Signe
m
Link: http://lkml.kernel.org/r/20170322104151.751993...@infradead.org
Signed-off-by: Thomas Gleixner
[Lee: Back-ported in support of a previous futex back-port attempt]
Signed-off-by: Lee Jones
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Zheng Yejian
---
kernel/f
Lee sent a patchset to update Futex for 4.9, see
https://www.spinics.net/lists/stable/msg443081.html,
Then Xiaoming sent a follow-up patch for it, see
https://lore.kernel.org/lkml/20210225093120.GD641347@dell/.
These patchsets may also resolve following issues in 4.4.260 which have been
reporte
Xiaoming Ni
Reviewed-by: Lee Jones
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Zheng Yejian
---
kernel/futex.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index 116766ef7de6..98c65b3c3a00 100644
--- a/kernel/futex.c
+++ b
This patch may fix the following bug:
Link:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/?h=linux-4.9.y&id=5b1d078507bd33ebf6c2083fa363cf5832809c19
> static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
> struct task_
Cc: Thomas Gleixner
Fixes: c1e2f0eaf015 ("futex: Avoid violating the 10th rule of futex")
Link:
http://lkml.kernel.org/r/20180122103947.gd2...@hirez.programming.kicks-ass.net
Signed-off-by: Ingo Molnar
Signed-off-by: Zheng Yejian
---
kernel/futex.c | 6 +++---
1 file changed, 3 insert
Cc: Thomas Gleixner
Fixes: c1e2f0eaf015 ("futex: Avoid violating the 10th rule of futex")
Link:
http://lkml.kernel.org/r/20180122103947.gd2...@hirez.programming.kicks-ass.net
Signed-off-by: Ingo Molnar
Signed-off-by: Zheng Yejian
---
kernel/futex.c | 7 +++
1 file changed, 3 insert
This patch may fix the following bug:
Link:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/kernel/futex.c?h=linux-4.9.y&id=282aeb477a10d09cc5c4d73c54bb996964723f96
> static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
>
51 matches
Mail list logo