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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250730093249.4833be14@gandalf.local.home>
Date: Wed, 30 Jul 2025 09:32:48 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Indu Bhagat <indu.bhagat@...cle.com>
Cc: Steven Rostedt <rostedt@...nel.org>, linux-kernel@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org, Masami Hiramatsu
 <mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
 Josh Poimboeuf <jpoimboe@...nel.org>, Peter Zijlstra
 <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>, Jiri Olsa
 <jolsa@...nel.org>, Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung
 Kim <namhyung@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Andrii
 Nakryiko <andrii@...nel.org>, "Jose E. Marchesi" <jemarch@....org>, Beau
 Belgrave <beaub@...ux.microsoft.com>, Jens Remus <jremus@...ux.ibm.com>,
 Linus Torvalds <torvalds@...ux-foundation.org>, Andrew Morton
 <akpm@...ux-foundation.org>, Jens Axboe <axboe@...nel.dk>, Florian Weimer
 <fweimer@...hat.com>, Sam James <sam@...too.org>
Subject: Re: [PATCH v16 03/10] unwind_user/deferred: Add unwind cache

On Tue, 29 Jul 2025 21:55:39 -0700
Indu Bhagat <indu.bhagat@...cle.com> wrote:

> > diff --git a/include/linux/unwind_deferred.h b/include/linux/unwind_deferred.h
> > index a5f6e8f8a1a2..baacf4a1eb4c 100644
> > --- a/include/linux/unwind_deferred.h
> > +++ b/include/linux/unwind_deferred.h
> > @@ -12,6 +12,12 @@ void unwind_task_free(struct task_struct *task);
> >   
> >   int unwind_user_faultable(struct unwind_stacktrace *trace);
> >   
> > +static __always_inline void unwind_reset_info(void)
> > +{
> > +	if (unlikely(current->unwind_info.cache))
> > +		current->unwind_info.cache->nr_entries = 0;
> > +}  
> 
> Should the entries[] items upto nr_entries (stack trace info from the 
> previous request) also be reset to 0 here ?

This is in a critical path, there's no reason to reset to zero. The data will
just be stale. Nothing should care about anything over nr_entries.

> > diff --git a/include/linux/unwind_deferred_types.h b/include/linux/unwind_deferred_types.h
> > index aa32db574e43..db5b54b18828 100644
> > --- a/include/linux/unwind_deferred_types.h
> > +++ b/include/linux/unwind_deferred_types.h
> > @@ -2,8 +2,13 @@
> >   #ifndef _LINUX_UNWIND_USER_DEFERRED_TYPES_H
> >   #define _LINUX_UNWIND_USER_DEFERRED_TYPES_H
> >   
> > +struct unwind_cache {
> > +	unsigned int		nr_entries;
> > +	unsigned long		entries[];
> > +};
> > +  
> 
> Should we use __counted_by ?

The size of entries[] is not determined by nr_entries. It is allocated on
the first use, and not freed until the task exits. It's a fixed size
defined by:

/* Make the cache fit in a 4K page */
#define UNWIND_MAX_ENTRIES					\
	((SZ_4K - sizeof(struct unwind_cache)) / sizeof(long))


-- Steve

	

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ