From 3ba34daaf7b12df37f1e1c0d512eec9861d8d8fe Mon Sep 17 00:00:00 2001 From: zhang-mingyi66 Date: Wed, 22 Mar 2023 04:14:45 +0800 Subject: [PATCH] fix use undefine function --- ...rt-libbpf-Handle-size-overflow-for-ringbuf-mmap.patch | 9 +++++---- libbpf.spec | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backport-libbpf-Handle-size-overflow-for-ringbuf-mmap.patch b/backport-libbpf-Handle-size-overflow-for-ringbuf-mmap.patch index 3e7edd0..8b3100f 100644 --- a/backport-libbpf-Handle-size-overflow-for-ringbuf-mmap.patch +++ b/backport-libbpf-Handle-size-overflow-for-ringbuf-mmap.patch @@ -17,8 +17,8 @@ Signed-off-by: Hou Tao Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20221116072351.1168938-3-houtao@huaweicloud.com --- - src/ringbuf.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) + src/ringbuf.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ringbuf.c b/src/ringbuf.c index 8caaafe..1890ed4 100644 @@ -42,7 +42,7 @@ index 8caaafe..1890ed4 100644 if (tmp == MAP_FAILED) { err = -errno; pr_warn("ringbuf: failed to mmap consumer page for map fd=%d: %d\n", -@@ -111,8 +111,12 @@ int ring_buffer__add(struct ring_buffer *rb, int map_fd, +@@ -111,8 +111,13 @@ int ring_buffer__add(struct ring_buffer *rb, int map_fd, * data size to allow simple reading of samples that wrap around the * end of a ring buffer. See kernel implementation for details. * */ @@ -51,7 +51,8 @@ index 8caaafe..1890ed4 100644 + 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); ++ errno = E2BIG; ++ return -errno; + } + tmp = mmap(NULL, (size_t)mmap_sz, PROT_READ, MAP_SHARED, map_fd, rb->page_size); if (tmp == MAP_FAILED) { diff --git a/libbpf.spec b/libbpf.spec index 552e838..d0ac48a 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -4,7 +4,7 @@ Name: %{githubname} Version: %{githubver} -Release: 6 +Release: 7 Summary: Libbpf library License: LGPLv2 or BSD @@ -80,6 +80,9 @@ developing applications that use %{name} %{_libdir}/libbpf.a %changelog +* Wed Mar 22 2023 zhangmingyi - 2:0.3-7 +- fix use undefine function + * Wed Feb 22 2023 JofDiamonds - 2:0.3-6 - backport patches from upstream -- Gitee