diff options
author | Chris Packham <judge.packham@gmail.com> | 2024-05-15 19:24:48 +1200 |
---|---|---|
committer | Chris Packham <judge.packham@gmail.com> | 2024-05-18 15:45:55 +1200 |
commit | 4dc87d49b02fa6bf1698deeb1fabb4106662dca9 (patch) | |
tree | 5bb4e43df3177e3b2177d2935d7af793fb8a516e | |
parent | cfbefefeec28f1747b17daf19956dec736c60730 (diff) | |
download | crosstool-ng-4dc87d49b02fa6bf1698deeb1fabb4106662dca9.tar.gz crosstool-ng-4dc87d49b02fa6bf1698deeb1fabb4106662dca9.tar.bz2 crosstool-ng-4dc87d49b02fa6bf1698deeb1fabb4106662dca9.zip |
uClibc-ng: Add patch for fstat64 build error
Resolve the following build error for arc-multilib-linux-uclibc.
libc/sysdeps/linux/common/fstat64.c: In function 'fstat64':
libc/sysdeps/linux/common/fstat64.c:33:38: error: passing argument 2 of '__syscall_fstat64' from incompatible pointer type [-Wincompatible-pointer-types]
33 | return __syscall_fstat64(fd, buf);
| ^~~
| |
| struct stat64 *
While we're at it bring in one more bug fix patch from upstream.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
-rw-r--r-- | packages/uClibc-ng/1.0.48/0007-malloc-memalign-avoid-integer-overflow.patch | 41 | ||||
-rw-r--r-- | packages/uClibc-ng/1.0.48/0008-fix-kernel_stat64-definition.patch | 33 |
2 files changed, 74 insertions, 0 deletions
diff --git a/packages/uClibc-ng/1.0.48/0007-malloc-memalign-avoid-integer-overflow.patch b/packages/uClibc-ng/1.0.48/0007-malloc-memalign-avoid-integer-overflow.patch new file mode 100644 index 00000000..234f3684 --- /dev/null +++ b/packages/uClibc-ng/1.0.48/0007-malloc-memalign-avoid-integer-overflow.patch @@ -0,0 +1,41 @@ +From 7343bd6a49c5e3fe622f0bf473c124947d5e1210 Mon Sep 17 00:00:00 2001 +From: Max Filippov <jcmvbkbc@gmail.com> +Date: Sun, 12 May 2024 17:36:50 -0700 +Subject: [PATCH 7/8] malloc/memalign: avoid integer overflow + +Check that the size passed to memalign() is not greater than PTRDIFF_MAX +before adjusting it, otherwise it may wrap around in the adjustment. +This fixes gcc testsuite test gcc.dg/torture/pr60092.c + +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> +--- + libc/stdlib/malloc/memalign.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libc/stdlib/malloc/memalign.c b/libc/stdlib/malloc/memalign.c +index 665f20cfb..54f6dbc6c 100644 +--- a/libc/stdlib/malloc/memalign.c ++++ b/libc/stdlib/malloc/memalign.c +@@ -11,6 +11,7 @@ + * Written by Miles Bader <miles@gnu.org> + */ + ++#include <errno.h> + #include <stdlib.h> + #include <unistd.h> + #include <sys/mman.h> +@@ -38,6 +39,11 @@ memalign (size_t alignment, size_t size) + unsigned long tot_addr, tot_end_addr, addr, end_addr; + struct heap_free_area **heap = &__malloc_heap; + ++ if (unlikely(size > PTRDIFF_MAX)) { ++ __set_errno(ENOMEM); ++ return NULL; ++ } ++ + /* Make SIZE something we like. */ + size = HEAP_ADJUST_SIZE (size); + +-- +2.43.2 + diff --git a/packages/uClibc-ng/1.0.48/0008-fix-kernel_stat64-definition.patch b/packages/uClibc-ng/1.0.48/0008-fix-kernel_stat64-definition.patch new file mode 100644 index 00000000..3c9610c6 --- /dev/null +++ b/packages/uClibc-ng/1.0.48/0008-fix-kernel_stat64-definition.patch @@ -0,0 +1,33 @@ +From 186878405324e96f61d896a149f623e0c792c972 Mon Sep 17 00:00:00 2001 +From: Max Filippov <jcmvbkbc@gmail.com> +Date: Tue, 14 May 2024 23:18:56 -0700 +Subject: [PATCH 8/8] fix kernel_stat64 definition + +The commit 74ca8d6f5d2e ("remove UCLIBC_HAS_LFS") removed conditional +compilation dependent on __UCLIBC_HAS_LFS__, assuming it to be always +defined, but removed the wrong branch in the definition of +kernel_stat64. +Fix kernel_stat64 definition to be stat64. + +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> +Tested-by: Chris Packham <judge.packham@gmail.com> +--- + libc/sysdeps/linux/common-generic/bits/kernel_stat.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libc/sysdeps/linux/common-generic/bits/kernel_stat.h b/libc/sysdeps/linux/common-generic/bits/kernel_stat.h +index 7a97bb4d7..e874a4a9f 100644 +--- a/libc/sysdeps/linux/common-generic/bits/kernel_stat.h ++++ b/libc/sysdeps/linux/common-generic/bits/kernel_stat.h +@@ -18,7 +18,7 @@ + * However that requires more #ifndef in relevant wrappers, + * further uglifying them + */ +-#define kernel_stat64 stat ++#define kernel_stat64 stat64 + + #endif /* _BITS_STAT_STRUCT_H */ + +-- +2.43.2 + |