I implemented that strchr()
global strchr
strchr:
cmp byte[rdi], 0
je end
cmp [rdi], sil
je end
add rdi, 1
jmp strchr
end: mov rax, rdi
ret
When I preload it as .so using,
export LD_PRELOAD=abs/path/to/lib.so
Ubuntu 16.04 crashes. Sometimes it completly crahses, sometimes it displays SIGILL (corrupted data ?).
When I preload it using opensuse 4, it works.
Any idea why ?