lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251208131917.2444620-1-dolinux.peng@gmail.com>
Date: Mon,  8 Dec 2025 21:19:15 +0800
From: Donglin Peng <dolinux.peng@...il.com>
To: rostedt@...dmis.org
Cc: linux-trace-kernel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	pengdonglin <pengdonglin@...omi.com>
Subject: [PATCH v2 0/2] Use BTF to trim return values

From: pengdonglin <pengdonglin@...omi.com>

This patch series addresses two limitations of the funcgraph-retval feature:

1. Previously, return values were printed even for void functions.
2. For return types narrower than a register, high-bit corruption could
   lead to incorrect values.

By leveraging BTF to obtain precise return type information, we now:

1. Suppress output for void functions (eliminating noise)
2. Properly truncate values to match the actual return type width (ensuring
  correctness)

These improvements make funcgraph-retval more accurate and useful.

Before:
 # perf ftrace -G vfs_read --graph-opts retval
 ...
 1)               |    _raw_spin_unlock() {
 1)   0.074 us    |      do_raw_spin_unlock(); /* ret=0x1 */
 1)   0.072 us    |      preempt_count_sub(); /* ret=0x0 */
 1)   0.373 us    |    } /* _raw_spin_unlock ret=0x80000000 */
 1)               |    down_read() {
 1)   0.070 us    |      __cond_resched(); /* ret=0x0 */
 1)   0.069 us    |      preempt_count_add(); /* ret=0x0 */
 1)   0.071 us    |      preempt_count_sub(); /* ret=0x0 */
 1)   0.612 us    |    } /* down_read ret=0x80000000 */
 1)               |    down_write() {
 1)   0.070 us    |      __cond_resched(); /* ret=0x0 */
 1)   0.071 us    |      preempt_count_add(); /* ret=0x0 */
 1)   0.070 us    |      preempt_count_sub(); /* ret=0x0 */
 1)   0.605 us    |    } /* down_write ret=0x80000000 */

After:
 # perf ftrace -G vfs_read --graph-opts retval
 ...
 0)               |    _raw_spin_unlock() {
 0)   0.075 us    |      do_raw_spin_unlock();
 0)   0.075 us    |      preempt_count_sub();
 0)   0.380 us    |    } /* _raw_spin_unlock */
 0)               |    down_read() {
 0)   0.070 us    |      __cond_resched(); /* ret=0x0 */
 0)   0.073 us    |      preempt_count_add();
 0)   0.072 us    |      preempt_count_sub();
 0)   0.586 us    |    } /* down_read */
 0)               |    down_write() {
 0)   0.070 us    |      __cond_resched(); /* ret=0x0 */
 0)   0.072 us    |      preempt_count_add();
 0)   0.072 us    |      preempt_count_sub();
 0)   0.676 us    |    } /* down_write */

Changelog:
v2:
- Update the funcgraph-retval documentation
- Revise the cover letter

v1:
- Link: https://lore.kernel.org/all/20251207142742.229924-1-dolinux.peng@gmail.com/

pengdonglin (2):
  fgraph: Use BTF to trim and filter return values
  tracing: Update funcgraph-retval documentation

 Documentation/trace/ftrace.rst       | 76 ++++++++++++++++------------
 kernel/trace/trace_functions_graph.c | 64 +++++++++++++++++++----
 2 files changed, 97 insertions(+), 43 deletions(-)

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ