All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matt Fleming" <matt@readmodwrite.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Marco Elver" <elver@google.com>
Cc: "Alexander Potapenko" <glider@google.com>,
	"Andrey Konovalov" <andreyknvl@gmail.com>,
	"Dmitry Vyukov" <dvyukov@google.com>,
	"Oscar Salvador" <osalvador@suse.de>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Caleb Kan" <ckan@cloudflare.com>,
	"Caleb Kan" <calebkan1106@gmail.com>,
	linux-mm@kvack.org, kasan-dev@googlegroups.com,
	kernel-team@cloudflare.com,
	"Matt Fleming" <mfleming@cloudflare.com>
Subject: Re: [PATCH v3 09/10] stackdepot: Store compressed frames in stack records
Date: Sat, 14 Nov 2026 18:58:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-214930@kernel.org> (raw)
In-Reply-To: <20261113185702.1332171-10-matt@readmodwrite.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] stackdepot: uninitialized frame in depot_stack_entry() on
  generic arches
--

commit 8ef363f0fde887ad99497bbd2e7b00c5bd8bac35
Author: Matt Fleming <mfleming@cloudflare.com>

stackdepot: Store compressed frames in stack records

This commit stores stack frames in a 32-bit compressed array inside
struct stack_record when all frames of a persistent stack trace can be
compressed by architecture hooks.

> diff --git a/lib/stackdepot.c b/lib/stackdepot.c
> index 8f1aaa0c6d889..f323f1e97e129 100644
> --- a/lib/stackdepot.c
> +++ b/lib/stackdepot.c
[ ... ]
> @@ -419,9 +422,37 @@ static struct stack_record *depot_pop_free(void)
>  	return stack;
>  }
>  
> -static inline size_t depot_stack_record_size(struct stack_record *s, unsigned int nr_entries)
> +/* Check whether every frame of a stack can be stored in 32 bits. */
> +static bool depot_entries_compressible(const unsigned long *entries,
> +				       unsigned int nr_entries)
> +{
> +	u32 payload;
> +
> +	for (unsigned int i = 0; i < nr_entries; i++) {
> +		if (!arch_stack_depot_frame_try_compress(entries[i], &payload))
> +			return false;
> +	}
> +	return true;
> +}
> +
> +static inline unsigned long depot_stack_entry(const struct stack_record *stack,
> +					      unsigned int i)
>  {
> -	const size_t used = flex_array_size(s, entries, nr_entries);
> +	unsigned long frame;
> +
> +	if (!(stack->flags & STACK_RECORD_COMPRESSED))
> +		return stack->entries[i];
> +	arch_stack_depot_frame_decompress(stack->compressed_entries[i], &frame);
> +	return frame;
> +}

[Severity: High]
Does depot_stack_entry() return an uninitialized frame on architectures
using the generic header?

include/asm-generic/stackdepot.h:arch_stack_depot_frame_decompress() {
	/* Generic code never compresses frames, so this hook is unreachable. */
}

Because stack->flags is read at runtime and the generic
arch_stack_depot_frame_decompress() neither writes to *frame nor calls
unreachable(), the compiler cannot tell that the compressed branch is dead.
In depot_stack_equal(), the early return when
!(stack->flags & STACK_RECORD_COMPRESSED) folds the same check inside the
inlined depot_stack_entry() call, leaving frame unconditionally
uninitialized in the loop and triggering -Wuninitialized build failures
under CONFIG_WERROR=y.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113185702.1332171-1-matt@readmodwrite.com?part=9


  reply	other threads:[~2026-11-14 18:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 18:56 [PATCH v3 00/10] stackdepot: store compressed frames in stack records Matt Fleming
2026-11-13 18:56 ` [PATCH v3 01/10] stackdepot: add caller-owned stack trace fetching Matt Fleming
2026-11-13 18:56 ` [PATCH v3 02/10] mm/kmemleak: use stack_depot_fetch_into() for leak reports Matt Fleming
2026-11-13 18:56 ` [PATCH v3 03/10] kmsan: use stack_depot_fetch_into() for origin reports Matt Fleming
2026-11-13 18:56 ` [PATCH v3 04/10] mm/slub: use stack_depot_fetch_into() for owner tracking Matt Fleming
2026-11-13 18:56 ` [PATCH v3 05/10] drm/locking: print deadlock backtraces with stack_depot_snprint() Matt Fleming
2026-11-13 18:56 ` [PATCH v3 06/10] mm/page_owner: Read stack traces with stack_depot_fetch_into() Matt Fleming
2026-11-13 18:56 ` [PATCH v3 07/10] stackdepot: Remove stack_depot_fetch() Matt Fleming
2026-11-13 18:57 ` [PATCH v3 08/10] stackdepot: add architecture hooks for compact frame storage Matt Fleming
2026-11-14 18:58   ` sashiko-bot
2026-11-13 18:57 ` [PATCH v3 09/10] stackdepot: Store compressed frames in stack records Matt Fleming
2026-11-14 18:58   ` sashiko-bot [this message]
2026-11-13 18:57 ` [PATCH v3 10/10] scripts/gdb: Decode compressed stack depot frames Matt Fleming
2026-11-14 18:58   ` sashiko-bot

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=sashiko-outbox-214930@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=calebkan1106@gmail.com \
    --cc=ckan@cloudflare.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-mm@kvack.org \
    --cc=matt@readmodwrite.com \
    --cc=mfleming@cloudflare.com \
    --cc=osalvador@suse.de \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vbabka@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.