-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jq segfaults when built with uclibc #2003
Comments
Have you tried https://uclibc-ng.org/ ? |
Nope. We stick with old version where void *malloc (size_t size)
{
...
#ifdef __MALLOC_GLIBC_COMPAT__
if (unlikely (size == 0))
size++;
#else
/* Some programs will call malloc (0). Lets be strict and return NULL */
if (unlikely (size == 0))
goto oom;
#endif
... uclibc-ng upstream removed ...
if (unlikely (size == 0))
size++;
... https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/stdlib/malloc/malloc.c#n211 So uclibc-ng should work here. Anyway
Even in glibc compatible case returned "fake" pointer should not be used later. I didn't have time to deeply investigate jq library code, so I hope it conforms and does not use returned pointer later. :) |
@nkulikov Can you confirm that the following patch fixes this:
? |
I can not check it right now, but will do it soon as I get access to hardware and environment. Thanks for your support! |
@nkulikov it'd sure be nice if we could setup some Travis builds using musl and uclibc or uclibc-ng. Any ideas how to do that? For musl it seems easy enough, but for uclibc or uclibc-ng it looks like we have to use tarballs. |
- Bumps jq package to latest to fix seg fault errors - jqlang/jq#2003 - I saw this on ARM64 compiled with uclibc, issue mentions MIPS, so might only be an issue for non-x86 Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com>
Bump jq package to latest to fix seg fault errors reported at jqlang/jq#2003 Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Bump jq package to latest to fix seg fault errors reported at jqlang/jq#2003 Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit c947941) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Bump jq package to latest to fix seg fault errors reported at jqlang/jq#2003 Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit c947941) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Bump jq package to latest to fix seg fault errors reported at jqlang/jq#2003 Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Bump jq package to latest to fix seg fault errors reported at jqlang/jq#2003 Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Sorry for so looooong response :) I found a time to replace our hack with more recent version of jq from upstream. a17dd32 still had this issue. I didn't catch idea with proposed patch because these changes already applied to upstream a long time ago (8dca3ef?). Or maybe I miss something? |
Describe the bug
jq built for MIPS by using gcc+uclibc toolchain segfaults on any input.
To Reproduce
Expected behavior
jq should not segfault on valid input.
Environment (please complete the following information):
Additional context
gdb backtrace:
It seems uclibc returns null pointer when
num
orsize
argument is zero.glibc in such situation returns not null pointer:
https://github.com/bminor/glibc/blob/master/malloc/malloc.c#L116
https://en.cppreference.com/w/c/memory/calloc
The text was updated successfully, but these errors were encountered: