libc

Why is the address of __libc_start_main always the same inside GDB even though ASLR is on?

痞子三分冷 提交于 2020-02-29 10:08:38
问题 Breakpoint 1, 0x00007ffff7de8060 in __libc_start_main () from /usr/lib/libc.so.6 (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/firstlove/projects/org-ioslide/example/a.out Breakpoint 1, 0x00007ffff7de8060 in __libc_start_main () from /usr/lib/libc.so.6 (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/firstlove/projects/org-ioslide/example/a

sigemptyset() NDK UnsatisfiedLinkError dlopen()

ぐ巨炮叔叔 提交于 2020-02-05 08:32:46
问题 A certain C-code in my Android NDK application, calls the sigemptyset() function defined in the signal.h. I am building my project using the NDK-r9 . My library file called "libnative-service.so" is built fine, after the c-code is compiled. But on running the application i get the following error regarding the refernce to sigemptyset() . Am i missing something ?? 09-22 15:13:09.102: E/art(3718): dlopen("/data/app-lib/com.project/libnative-service.so", RTLD_LAZY) failed: dlopen failed: cannot

AOSP non-obvious syscall() implementation

…衆ロ難τιáo~ 提交于 2020-01-24 22:46:08
问题 As far as I know Linux ABI for ARM states that syscall return value is passed via r0 and if it is negative it should be threaded as errno value negated. I.e syscall has ended up with some error. AOSP does this check in some fancy way: ENTRY(syscall) mov ip, sp stmfd sp!, {r4, r5, r6, r7} .cfi_def_cfa_offset 16 .cfi_rel_offset r4, 0 .cfi_rel_offset r5, 4 .cfi_rel_offset r6, 8 .cfi_rel_offset r7, 12 mov r7, r0 mov r0, r1 mov r1, r2 mov r2, r3 ldmfd ip, {r3, r4, r5, r6} swi #0 ldmfd sp!, {r4, r5

Can I fix a “version GLIBC_2.14 not found” error without being sysadmin?

两盒软妹~` 提交于 2020-01-24 19:33:06
问题 I am trying to run a setup.py file on a remote machine in a Conda environment. I get the following error message: from torch.utils.cpp_extension import BuildExtension, CUDAExtension File "/home/pbrook/miniconda3/envs/super_resolution/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module> from torch._C import * ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found I found one post that suggests that I don't have a high enough version of libc6 . My question: is it possible

What's the difference between libc6:i386 and libc6-i386

寵の児 提交于 2020-01-16 07:49:10
问题 I'm using Ubuntu 14.04.2 LTS \n \l . Here are the libc s I installed. $ dpkg --list | grep libc6 ii libc6:amd64 2.19-0ubuntu6.7 amd64 Embedded GNU C Library: Shared libraries ii libc6-dbg:amd64 2.19-0ubuntu6.7 amd64 Embedded GNU C Library: detached debugging symbols ii libc6-dev:amd64 2.19-0ubuntu6.7 amd64 Embedded GNU C Library: Development Libraries and Header Files ii libc6-i386 2.19-0ubuntu6.7 amd64 Embedded GNU C Library: 32-bit shared libraries for AMD64 rc libc6-x32 2.19-0ubuntu6.7

How does a program inherit environment variables?

泪湿孤枕 提交于 2020-01-13 19:44:43
问题 When I use the function getenv() from the Standard C Library, my program inherit the environment variables from its parent. Example: $ export FOO=42 $ <<< 'int main() {printf("%s\n", getenv("FOO"));}' gcc -w -xc - && ./a.exe 42 In libc, the environ variable is declared into environ.c . I am expecting it to be empty at the execution, but I get 42 . Going a bit further getenv can be simplified as follow: char * getenv (const char *name) { size_t len = strlen (name); char **ep; uint16_t name

How does a program inherit environment variables?

不问归期 提交于 2020-01-13 19:42:07
问题 When I use the function getenv() from the Standard C Library, my program inherit the environment variables from its parent. Example: $ export FOO=42 $ <<< 'int main() {printf("%s\n", getenv("FOO"));}' gcc -w -xc - && ./a.exe 42 In libc, the environ variable is declared into environ.c . I am expecting it to be empty at the execution, but I get 42 . Going a bit further getenv can be simplified as follow: char * getenv (const char *name) { size_t len = strlen (name); char **ep; uint16_t name

os x 32-bit printf from assembler

落爺英雄遲暮 提交于 2020-01-06 20:14:34
问题 I'm back again - thanks to the kind folks here, especially @Jester and @PeterCordes, I have three out of my four target platforms working. I have Win 32 and Win 64 working, and I have OS X 64 working, but I can't seem to make OS X assembly work in 32-bit using the libc library. I can do a "hello world" and other things using syscall (64-bit) and int 0x80 (32-bit), and I can make _printf work in 64-bit, but I can't manage to make it work in 32-bit. In theory, I need to push the parameters onto

Am I using tm/mktime wrong, and if not is there a workaround?

落花浮王杯 提交于 2020-01-04 03:54:25
问题 I think the following program should output the seconds to 1970 for the first day of every year from 1AD to 1970, preceded by the size of time_t on the system it's compiled on ( CHAR_BIT is a macro so I think you can't just copy the compiled executable around and assume it's correct though in practice everything uses 8 bit char s these days). #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> void do_time(int year) { time_t utc; struct tm tp;

return to libc works in gdb but not when running alone

做~自己de王妃 提交于 2020-01-03 03:20:14
问题 I am trying return to libc trick with the following simple code: #define SYSTEM_CALL_ADDR 0xb7ec5e50 /*my system call addr*/ #define EXIT_CALL_ADDR 0xb7ebbb80 /*my exit call addr*/ char shell[] = "/bin/sh"; int main(){ int* p; p = (int*)&p + 2; *p = SYSTEM_CALL_ADDR; p = (int*)&p + 3; *p = EXIT_CALL_ADDR; p = (int*)&p + 4; *p = shell; return 1; } Interestingly when I run this program, it ends with "Segmentation error", but if I debug it using gdb and run it step by step, it's totally fine,