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]
Date: Thu, 26 Oct 2023 15:44:59 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Kees Cook <keescook@...omium.org>
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>, Christoph Hellwig
 <hch@....de>, Justin Stitt <justinstitt@...gle.com>, Kent Overstreet
 <kent.overstreet@...ux.dev>, Petr Mladek <pmladek@...e.com>, Andy
 Shevchenko <andriy.shevchenko@...ux.intel.com>, Rasmus Villemoes
 <linux@...musvillemoes.dk>, Sergey Senozhatsky <senozhatsky@...omium.org>,
 Masami Hiramatsu <mhiramat@...nel.org>, Greg Kroah-Hartman
 <gregkh@...uxfoundation.org>, Arnd Bergmann <arnd@...db.de>, Jonathan
 Corbet <corbet@....net>, Yun Zhou <yun.zhou@...driver.com>, Jacob Keller
 <jacob.e.keller@...el.com>, Zhen Lei <thunder.leizhen@...wei.com>,
 linux-trace-kernel@...r.kernel.org, Yosry Ahmed <yosryahmed@...gle.com>,
 linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] seq_buf: Introduce DECLARE_SEQ_BUF and seq_buf_str()

On Thu, 26 Oct 2023 12:40:37 -0700
Kees Cook <keescook@...omium.org> wrote:

> @@ -81,16 +88,20 @@ static inline unsigned int seq_buf_used(struct seq_buf *s)
>   *
>   * After this function is called, s->buffer is safe to use
>   * in string operations.
> + *
> + * Returns @s->buf after making sure it is terminated.
>   */
> -static inline void seq_buf_terminate(struct seq_buf *s)
> +static inline char *seq_buf_str(struct seq_buf *s)

Looking at show_buffer() (below), I wonder if this should be:

static inline const char *seq_buf_str() ?

I mean, it can be modified, but do we want to allow that?

-- Steve


>  {
>  	if (WARN_ON(s->size == 0))
> -		return;
> +		return "";
>  
>  	if (seq_buf_buffer_left(s))
>  		s->buffer[s->len] = 0;
>  	else
>  		s->buffer[s->size - 1] = 0;
> +
> +	return s->buffer;
>  }
>  
>  /**
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index d629065c2383..2539cfc20a97 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -3828,15 +3828,6 @@ static bool trace_safe_str(struct trace_iterator *iter, const char *str,
>  	return false;
>  }
>  
> -static const char *show_buffer(struct trace_seq *s)
> -{
> -	struct seq_buf *seq = &s->seq;
> -
> -	seq_buf_terminate(seq);
> -
> -	return seq->buffer;
> -}
> -
>  static DEFINE_STATIC_KEY_FALSE(trace_no_verify);
>  

Powered by blists - more mailing lists