[lkml]   [2022]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectlinux-next: manual merge of the bpf-next tree with the bpf tree
Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:


between commit:

927cbb478adf ("libbpf: Handle size overflow for ringbuf mmap")

from the bpf tree and commit:

b486d19a0ab0 ("libbpf: checkpatch: Fixed code alignments in ringbuf.c")

from the bpf-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

Stephen Rothwell

diff --cc tools/lib/bpf/ringbuf.c
index 6af142953a94,51808c5f0014..000000000000
--- a/tools/lib/bpf/ringbuf.c
+++ b/tools/lib/bpf/ringbuf.c
@@@ -128,13 -128,9 +128,13 @@@ int ring_buffer__add(struct ring_buffe
/* Map read-only producer page and data pages. We map twice as big
* data size to allow simple reading of samples that wrap around the
* end of a ring buffer. See kernel implementation for details.
- * */
+ */
- tmp = mmap(NULL, rb->page_size + 2 * info.max_entries, PROT_READ,
- MAP_SHARED, map_fd, rb->page_size);
+ mmap_sz = rb->page_size + 2 * (__u64)info.max_entries;
+ if (mmap_sz != (__u64)(size_t)mmap_sz) {
+ pr_warn("ringbuf: ring buffer size (%u) is too big\n", info.max_entries);
+ return libbpf_err(-E2BIG);
+ }
+ tmp = mmap(NULL, (size_t)mmap_sz, PROT_READ, MAP_SHARED, map_fd, rb->page_size);
if (tmp == MAP_FAILED) {
err = -errno;
ringbuf_unmap_ring(rb, r);
[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2022-11-21 02:28    [W:0.026 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site