From: sashiko-bot@kernel.org
To: "Jim Cromie" <jim.cromie@gmail.com>
Cc: linux-modules@vger.kernel.org
Subject: Re: [PATCH v4 22/25] selftests-dyndbg: add a dynamic_debug run_tests target
Date: Tue, 02 Jun 2026 23:01:19 +0000 [thread overview]
Message-ID: <20260602230119.5DF531F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602-dd-maint-2-v4-22-19a1445585a8@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Unconditional full read of the trace buffer risks memory exhaustion and test hangs.
- [Low] Flawed shell redirection fails to silence stderr in `ifrmmod`.
--
commit b7cfa1be78853b6d269ce0f8b3593fb8481c478f
Author: Jim Cromie <jim.cromie@gmail.com>
selftests-dyndbg: add a dynamic_debug run_tests target
This commit adds a selftest script for dynamic-debug and includes it in
the selftests Makefile. The script currently has basic tests which modify
pr_debug() flags in the builtin params module.
> diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> new file mode 100755
> index 0000000000000..1239f1e105911
> --- /dev/null
> +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
[ ... ]
> +function error_log_ref {
> + # to show what I got
> + : echo "# error-log-ref: $1"
> + : echo cat \$2
> +}
> +
> +function ifrmmod {
> + lsmod | grep "$1" 2>&1>/dev/null && rmmod $1
> +}
[Severity: Low]
Are the shell redirections in the correct order in ifrmmod()?
Bash evaluates redirections left-to-right, so `2>&1` first redirects stderr
to the original stdout, and `>/dev/null` then redirects stdout to
`/dev/null`. This causes any stderr produced by the command to leak to the
terminal instead of being properly silenced.
Should this use `>/dev/null 2>&1` instead?
[ ... ]
> +# $1 - trace instance name, 0 for global event trace
> +# $2 - line number counting from the bottom
> +# $3 - text to search for
> +function search_trace_name() {
> + if [ "$1" = "0" ]; then
> + buf=$(cat /sys/kernel/tracing/trace)
[Severity: Medium]
Will this unconditional read of the entire trace buffer risk memory
exhaustion?
Ftrace buffers can grow to hundreds of megabytes or gigabytes, and reading
them entirely into bash memory risks OOM kills or severe performance
degradation.
Additionally, if a specific line is requested for checking (when `$2 != 0`),
the `buf` variable is populated but ignored during the search evaluation,
making the expensive read entirely useless.
Although the commit message notes these functions will be used shortly,
could this logic flaw cause test hangs when the function is utilized?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602-dd-maint-2-v4-0-19a1445585a8@gmail.com?part=22
next prev parent reply other threads:[~2026-06-02 23:01 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 22:47 [PATCH v4 00/25] dynamic-debug cleanups refactors maintenance + alignment fix Jim Cromie
2026-06-02 22:47 ` [PATCH v4 01/25] docs/dyndbg: update examples \012 to \n Jim Cromie
2026-06-02 22:47 ` [PATCH v4 02/25] docs/dyndbg: explain flags parse 1st Jim Cromie
2026-06-02 22:48 ` [PATCH v4 03/25] vmlinux.lds.h: refactor BOUNDED_SECTION_* macros into bounded_sections.lds.h Jim Cromie
2026-06-02 22:48 ` [PATCH v4 04/25] vmlinux.lds.h: drop unused HEADERED_SECTION* macros Jim Cromie
2026-06-02 22:48 ` [PATCH v4 05/25] vmlinux.lds.h: Fix ALIGN(8) omission causing NULL ptr on i386 Jim Cromie
2026-06-02 22:48 ` [PATCH v4 06/25] vmlinux.lds.h: remove redundant ALIGN(8) directives Jim Cromie
2026-06-02 22:48 ` [PATCH v4 07/25] dyndbg.lds.S: fix lost dyndbg sections in modules Jim Cromie
2026-06-02 22:48 ` [PATCH v4 08/25] dyndbg: factor ddebug_match_desc out from ddebug_change Jim Cromie
2026-06-02 22:48 ` [PATCH v4 09/25] dyndbg: add stub macro for DECLARE_DYNDBG_CLASSMAP Jim Cromie
2026-06-02 22:48 ` [PATCH v4 10/25] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Jim Cromie
2026-06-02 22:48 ` [PATCH v4 11/25] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Jim Cromie
2026-06-02 23:00 ` sashiko-bot
2026-06-02 22:48 ` [PATCH v4 12/25] dyndbg: drop NUM_TYPE_ARGS Jim Cromie
2026-06-02 22:57 ` sashiko-bot
2026-06-02 22:48 ` [PATCH v4 13/25] dyndbg: reduce verbose/debug clutter Jim Cromie
2026-06-02 22:48 ` [PATCH v4 14/25] dyndbg: refactor param_set_dyndbg_classes and below Jim Cromie
2026-06-02 22:48 ` [PATCH v4 15/25] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Jim Cromie
2026-06-02 22:48 ` [PATCH v4 16/25] dyndbg: replace classmap list with an array-slice Jim Cromie
2026-06-02 23:01 ` sashiko-bot
2026-06-02 22:48 ` [PATCH v4 17/25] dyndbg: macrofy a 2-index for-loop pattern Jim Cromie
2026-06-02 22:48 ` [PATCH v4 18/25] dyndbg: Upgrade class param storage to u64 for 64-bit classmaps Jim Cromie
2026-06-02 23:04 ` sashiko-bot
2026-06-02 22:48 ` [PATCH v4 19/25] dyndbg,module: make proper substructs in _ddebug_info Jim Cromie
2026-06-02 22:48 ` [PATCH v4 20/25] dyndbg: move mod_name down from struct ddebug_table to _ddebug_info Jim Cromie
2026-06-02 22:48 ` [PATCH v4 21/25] dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module Jim Cromie
2026-06-02 22:48 ` [PATCH v4 22/25] selftests-dyndbg: add a dynamic_debug run_tests target Jim Cromie
2026-06-02 23:01 ` sashiko-bot [this message]
2026-06-02 22:48 ` [PATCH v4 23/25] dyndbg: change __dynamic_func_call_cls* macros into expressions Jim Cromie
2026-06-02 22:48 ` [PATCH v4 24/25] lib/parser: add match_wildcard_hyphen() for agnostic matching Jim Cromie
2026-06-02 22:48 ` [PATCH v4 25/25] dynamic_debug: use KBUILD_MODFILE for unique builtin module names Jim Cromie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260602230119.5DF531F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jim.cromie@gmail.com \
--cc=linux-modules@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox