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] [day] [month] [year] [list]
Date:   Tue, 21 Mar 2023 12:51:59 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Vincent Donnefort <vdonnefort@...gle.com>
Cc:     mhiramat@...nel.org, linux-kernel@...r.kernel.org,
        linux-trace-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH 1/2] ring-buffer: Introducing ring-buffer mapping
 functions

On Tue, 21 Mar 2023 16:20:42 +0000
Vincent Donnefort <vdonnefort@...gle.com> wrote:

> > > Do we want a specific field here? That could be deduced from nr_data_pages()
> > > quite easily?  
> > 
> > I rather not have too much implementation detail knowledge in user space.
> > It only removes a single entry, and it makes user space easier. In fact,  
> 
> Ack.
> 
> > I'm thinking we should not include "__u32 data_pages[]" but instead add a:
> > "__u32 data_start" where user space does:
> > 
> > 	__u32 *data_pages = (_u32 *)meta_page + meta_page->data_start;
> > 
> > That way we could extend the data provided by the meta_page in the future.  
> 
> That'd be nice. Couldn't we keep both to simplify the code for the kernel side?

I would not expose the data_pages[] to user space, because then they'll use
it, and that *will* become an API.

But we could expose it to the kernel side with;

include/uapi/linux/trace_mmap.h:

struct ring_buffer_meta_page {
#if __BITS_PER_LONG == 64
	__u64	entries;
	__u64	overrun;
#else
	__u32	entries;
	__u32	overrun;
#endif
	__u32	pages_touched;
	__u32	reader_page;
	__u32	nr_data_pages;	/* doesn't take into account the reader_page */
	__u32	data_page_head;	/* index of data_pages[] */
	__u32	meta_page_size;	/* size of the meta page */
	__u32	data_start;	/* offset to where data_pages are */
};

kernel/trace/ring_buffer.c:

struct ring_buffer_meta {
	struct ring_buffer_meta_page	meta;
	u32				data_pages[];
}

Then we can start each function with:

	struct ring_buffer_meta_page *meta = &cpu_buffer->meta_page.meta;
	u32 *data_pages = cpu_buffer->meta_page.data_pages;

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ