Questions tagged [libc]

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

Filter by
Sorted by
Tagged with
0
votes
1answer
23 views

Root shell after ret2libc buffer overflow exploit not spawning

I want to learn ret2libc buffer overflows, so i wanted to do stack6 on the protostar machine. First, ive got the address of system, then the address of exit and the address of \bin\sh. But when im ...
0
votes
1answer
41 views

libc crate doesn't provide sprintf on Windows

I wrote a library in Rust that uses C formatting using the sprintf function provided by the libc crate. Everything works on macOS and Linux but it does not compile on Windows because the sprintf ...
-1
votes
0answers
18 views

going back from activity show me libc error

Back from activity some unknown error show in android A/libc: Fatal signal 11 (SIGSEGV) at 0x00000002 (code=1), thread 20346 (ungledualframes) this code 0x00000002 and thread 20346 is always change
1
vote
1answer
42 views

libstdc++.so not found when using patchelf and alternate glibc version

I am working on a system with a system wide glibc 2.27 and am using pathelf to patch some executable to a customized version of glibc 2.23. The executables are compiled with a custom version of LLVM. ...
0
votes
1answer
15 views

Does process linking still load o files in libc.a?

I am looking at this lecture note (slide #6): file.o contains external symbols and defined symbols libc.a contains .o files for all library functions. Process of linking: scan libc.a for symbols ...
0
votes
0answers
30 views

printfs hangs in kubernetes environment

I am debugging an app for a hang. This is running as a container in the kubernetes environment. The app is multi threaded and implements a fuse file system. Thread 7 (Thread 0x7f631da4d700 (LWP 20))...
0
votes
0answers
25 views

memmove in osdev meaty-skeleton: why does it have these if/else statements? [duplicate]

In the os-dev meaty skeleton tutorial this is the implementation of memmove: #include <string.h> void* memmove(void* dstptr, const void* srcptr, size_t size) { unsigned char* dst = (...
2
votes
1answer
56 views

installing `libm.so.6` through Anaconda

I have a centOS machine that I do not have sudo access. I needed to use librosa python package so I have installed Anaconda and installed the package through conda. However, when I import this ...
3
votes
1answer
62 views

How to find the maximum value(s) in a RB tree

I'm working on a project which requires me to create and frequently search a RB tree using the glibc functions found in search.h. I have no problem creating the tree nor searching it; however, I just ...
0
votes
1answer
105 views

Fatal Signal on Launch (KitKat)

I've been receiving the following error on KitKat but there are no issues on Android M and above : 2145-2145/com.cafeapps.stroydownloader E/dalvikvm: Could not find class 'com.crashlytics.android.ndk....
0
votes
0answers
30 views

would it be safe to get the length of arguments with strlen? [duplicate]

I want to get the length of command-line arguments but I'm not sure if strlen is a secure solution. strlen works as intended, but apparently it's not secure since the string being measured may not be ...
1
vote
1answer
58 views

Is it possible to check whether a C macro is defined on your system in Rust?

I'm aware that the libc crate in Rust contains much of C's standard macros and functions for use in Rust, but it also states that it is not concerned with portability between systems. I'm porting some ...
1
vote
1answer
66 views

How to include (msvc) libc when building c code with the Zig compiler

I've recently discovered zig and find it very interesting. I'm now trying to learn how to use zig as a cross compiler and, the following builds and runs fine (on Windows) zig cc -Wno-everything src/...
2
votes
2answers
34 views

Understanding the gcc version and the GLIBC, GLIBCXX versions in more detail

Assume I have the following local gcc, g++ version: $ gcc -v $ g++ -v gcc version 6.3.1 I don't understanding the relation and meaning of the following compared to my compiler version: What is this ...
3
votes
1answer
135 views

React native 0.59 application crashes with libc error

I'm having the following problem on [email protected] It happens randomly on some screens in the app. any idea what would cause this? should I open a bug report in the react-native repo? Here is ...
1
vote
0answers
19 views

cross-plat version of _wfullpath()

is there a cross platform version of _fullpath() which is windows specific function? looking for a portable library function for this. tried realpath() but this is supported for linux and Mac but not ...
2
votes
1answer
90 views

How to find out which files are being linked with “-lc”?

After spending almost an hour on filtering output of clang -v hello_world.c I got the following linking command: ld -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 \ /usr/lib/x86_64-linux-...
4
votes
2answers
105 views

How does the libc function isatty() work?

I searched the linux repo and couldn't find a definition for it, so I guess it's something that comes with C or something like that? I'm trying to understand how isatty is able to tell whether a file ...
5
votes
2answers
94 views

fgets(), signals (EINTR) and input data integrity

fgets() was intended for reading some string until EOF or \n occurred. It is very handy for reading text config files, for example, but there are some problems. First, it may return EINTR in case of ...
2
votes
1answer
75 views

What happens when two or more threads or processes ftruncate(2) the same file?

As far as I understand, ftruncate(2) can't be atomic when I am expanding a file upto 2 GB length. But what exactly happens behind the scenes? I have applied it and it seems to work fine when more ...
1
vote
1answer
58 views

ImageMagick Error: “corrupted size vs. prev_size” in libc.so on Linux

I am using imagemagick 7 to read and write some TIFF files. I have C++ code to do the same and it is working fine with windows. I am facing this issue while writing TIFF file on Linux. I magemagick is ...
1
vote
2answers
121 views

How to avoid multiple definitions? Linker ignored defined symbol with some exception

I am working on an embedded system which has its own library (e.g. libc_alt ) implementing some functions from standard libc (fopen, fclose, fread, fseek, ftell) but not all ( I need memset, memcpy, ...
0
votes
1answer
38 views

Modify compile steps of glibc

I am trying to recompile the standard Glibc 2.20, with a requirement that I disable optimizations for a few specific components. In particular, I'm looking to remove the -O2 flag that's inherited from ...
1
vote
0answers
36 views

fprintf in assembly and stdout [duplicate]

In order to call fprintf from assembly code, I write the following ; push arguments... push dword [stdout] ; given from "extern stdout" call fprintf ; clean stack.. And it works just fine. However,...
0
votes
0answers
24 views

How can I force gnu ld to override the symbols in my own copy of a libc with the symbols from -lc?

I am porting uClibc to an rtos, which has as one of its' bsp targets the ability to run on top of posix. Unfortunately, this means that when compiling for the posix target, if I link everything ...
0
votes
0answers
16 views

different naming conventions in libc

When I check the functions inside libc using objdump, I've seen at least two different naming convention: with or without 'libc' __read __libc_system What's the meaning of 'libc' here, and why does ...
3
votes
1answer
131 views

Jump to entry point of ELF from loader

Thanks to the help in this question, the loader can now map a statically compiled hello world into memory and jump somewhere in that memory region. The problem I'm facing now is I seem not to jump to ...
0
votes
1answer
19 views

How to fix “Section .vectors overlaps section .data ” | Adding ATmega1281 Support to Compiler

So, I was working on a project to add ATmega1281 architecture support to my Toolchain. I was having avr-gcc-v3.3, avr-binutils-2.13.1, and avr-libc-cvs2003. I have added the ATmega1281 support to ...
1
vote
1answer
70 views

Redefine some functions of gcc-arm-none-eabi's stdlibc

STM32 chips (and many others) have hardware random number generator (RNG), it is faster and more reliable than software RNG provided by libc. Compiler knows nothing about hardware. Is there a way to ...
6
votes
1answer
549 views

Go build with another glibc

I have installed another version of GLIBC and want to compile Golang code against this new GLIBC. I have tried the following command for dynamic compilation: go build --ldflags '-linkmode external -...
1
vote
1answer
177 views

Linking a program using printf with ld?

I'm getting a undefined reference to _printf when building an assembly program that defines its own _start instead of main, using NASM on x86-64 Ubuntu Build commands: nasm -f elf64 hello.asm ...
7
votes
3answers
94 views

Redefining functions lin libC

Assume the following simple C code: file1.c #include <stdio.h> char* gets(char* i){ return i; } which is redefining the libC native function gets. This compiles fine with gcc file1.c. My ...
1
vote
1answer
90 views

Both libc.so.6 and libc.so exist in rootfs

I used Yocto to generated my rootfs, and a wired thing happened, both libc.so.6 and libc.so existing in my rootfs (/usr/lib/libc.so and /lib/libc.so.6). But they are different objects (not linking to ...
1
vote
1answer
52 views

Perf probe event for C variable assignment

I've been using perf probe with malloc, but can't seem to find a suitable perf event for when variable assignment happens. Is there such an event? Ideally when something like int var = 17; occurs ...
0
votes
1answer
47 views

How to add a C program between libc and syscall in Android?

I'm developing a project in android.Which will intercept all of the I/O request(read/write) in an application.Now I decide to achieve it in libc's read/write function.But I found that the read/write ...
0
votes
0answers
20 views

How do I get the name of a socket option in C?

I have some code that looks like this: switch (option) { case MVM_SO_BROADCAST: case MVM_SO_KEEPALIVE: case MVM_SO_REUSEADDR: case MVM_SO_DONTROUTE: case ...
0
votes
0answers
47 views

How does 32-bit socketcall system call work based on the libc assembly? [duplicate]

I am trying to understand how 32-bit socketcall work by reading the assembly code in socket API and a few others in Libc library. 000ed9f0 <socket>: ed9f0: 89 da mov %...
0
votes
0answers
385 views

How to add ldd utility to bitbake image

I need ldd utility in my final image of yocto. When I needed usbutils before, I went ahead and added the line in ../build/conf/local.conf file CORE_IMAGE_EXTRA_INSTALL += "usbutils" After searching ...
0
votes
1answer
22 views

Does fopen call CreateFile on Windows?

From what I know CreateFile is found in kernel32.dll, and fopen is found in libc. Assuming for this question they are both being used for file operations, does fopen call CreateFile on Windows or is ...
0
votes
1answer
66 views

Wrong result for atan2 with glibc / libm and float32

I am currently developing the firmware for a medical device where a lot of difficult mathematical operations is involved. The target processor supports floating point operation in hardware, but only ...
1
vote
0answers
98 views

How to get /proc/net/dev data with sysctl function call?

In my app I need network usage statistics (received bytes and packets) for each interface in the system. I found how to do that in FreeBSD: static int name[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, ...
2
votes
2answers
28 views

Which library do I have to link for the GNU libc extension tdestroy

I am trying to link a c program that I compiled with the gcc compiler. The linker does not find the symbol tdestroy which is a gnu extension to libc (#define __USE_GNU followed by #include <search....
1
vote
0answers
59 views

Downgrade libc6 version [duplicate]

ldd --version shows that I have Ubuntu GLIBC 2.27-3ubuntu1, and I need a version <= 2.24. Tried to use sudo apt-get install libc6==2.23-0ubuntu1 but it says this version cannot be found. I have ...
1
vote
0answers
39 views

How to know the call graphs of the functions in libc?

I'd like to know the call graph of functions in libc. For examples, what functions does puts() call. Is there an easy way to do it? Thanks.
1
vote
1answer
98 views

Why does gcc/clang know to link to libc by default?

When I run clang/gcc to compile a .c file, I don't need to explicitly link to libc. But it still works as libc and two additional libraries are automatically linked. Why does gcc/clang know to link ...
3
votes
1answer
192 views

libc's system() when the stack pointer is not 16-padded causes segmentation fault

I've noticed a really weird behavior when I was playing with libc's system() function on x86-64 linux, sometimes the call to system() fails with a segmentation fault, here's what I got after debugging ...
0
votes
0answers
19 views

What (Microsoft) library do I have to link to for tsearch?

I am trying to use tsearch and tfind in an executable that is compiled with Microsoft's compiler and linker. The compilation unit includes <search.h> and uses tsearch and compiles fine with cl. ...
2
votes
2answers
86 views

overwrite malloc/free in dlopen-ed library

I have a shared library - plugin.so, which is dlopen-ed by the host program with flag RTLD_LOCAL, I have my own memory operation functions defined in that library: void *plugin_malloc(size_t size) { /...
0
votes
1answer
315 views

appcompat activity crash api 28

today i ran into a rare problem. we have an app which is working for some time on many devices. yesterday we had a feedback from one of our users who says our app crashes at launch on his device. ...
1
vote
1answer
76 views

../sysdeps/i386/i686/multiarch/strcpy.c: No such file or directory

I'm trying to debug a program with gdb and when I set a breakpoint and continue on the strcpy() function. I get the following response: [email protected]:~/Documents/theclang/programs/helloworld$ gcc -fno-...