Skip to content
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

Jmp functions not unhooked completely #4

Closed
GammaPi opened this issue Nov 28, 2021 · 1 comment
Closed

Jmp functions not unhooked completely #4

GammaPi opened this issue Nov 28, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@GammaPi
Copy link
Member

GammaPi commented Nov 28, 2021

It turns out jmp functions can be identified by noreturn flag.
If any function calls this function, that function should also be unhooked, but there seem to be no way to know which function called these function other than using gdb and check return log.
A good news is these functions are not called frequently.
It is possible to only attach prehook to it.

ChangeLog.old/ChangeLog.13:     * include/unistd.h (_exit): Add __noreturn__ to libc_hidden_proto call.
ChangeLog.old/ChangeLog.6:      (_dl_signal_error): Remove  __attribute__ ((__noreturn__)).
ChangeLog.old/ChangeLog.10:     * elf/ldsodefs.h (_dl_signal_error): Mark as __noreturn__.
ChangeLog.old/ChangeLog.19:     * setjmp/tst-setjmp.c (jump): Use __attribute__ ((__noreturn__)).

sunrpc/svc_unix.c:static void svcunix_rendezvous_abort (void) __attribute__ ((__noreturn__));
sunrpc/svc_tcp.c:static void svctcp_rendezvous_abort (void) __attribute__ ((__noreturn__));

elf/dl-tls.c:__attribute__ ((__noreturn__))

setjmp/setjmp.h:     __THROWNL __attribute__ ((__noreturn__));
setjmp/setjmp.h:     __THROWNL __attribute__ ((__noreturn__));
setjmp/setjmp.h:     __THROWNL __attribute__ ((__noreturn__));

setjmp/bits/setjmp2.h:                        __longjmp_chk) __attribute__ ((__noreturn__));
setjmp/bits/setjmp2.h:                        __longjmp_chk) __attribute__ ((__noreturn__));
setjmp/bits/setjmp2.h:                        __longjmp_chk) __attribute__ ((__noreturn__));
setjmp/bits/setjmp2.h:     __THROWNL __attribute__ ((__noreturn__));

setjmp/tst-setjmp.c:static __attribute__ ((__noreturn__)) void

_Noreturn


timezone/private.h:#  define _Noreturn __attribute__ ((__noreturn__))

posix/unistd.h:extern void _exit (int __status) __attribute__ ((__noreturn__));

stdlib/exit.h:  attribute_hidden __attribute__ ((__noreturn__));

stdlib/stdlib.h:extern void abort (void) __THROW __attribute__ ((__noreturn__));
stdlib/stdlib.h:extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
stdlib/stdlib.h:extern void quick_exit (int __status) __THROW __attribute__ ((__noreturn__));
stdlib/stdlib.h:extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__));

stdlib/tst-random.c:void fail (const char *msg, int s, int i) __attribute__ ((__noreturn__));

sysdeps/nptl/futex-internal.h:static __always_inline __attribute__ ((__noreturn__)) void

sysdeps/nptl/pthread.h:extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
sysdeps/nptl/pthread.h:     __cleanup_fct_attribute __attribute__ ((__noreturn__))

sysdeps/nptl/pthreadP.h:     __cleanup_fct_attribute __attribute ((__noreturn__))
sysdeps/nptl/pthreadP.h:     __cleanup_fct_attribute __attribute ((__noreturn__))
sysdeps/nptl/pthreadP.h:extern void __pthread_exit (void *value) __attribute__ ((__noreturn__));

sysdeps/generic/ldsodefs.h:  __attribute__ ((__format__ (__printf__, 1, 2), __noreturn__));
sysdeps/generic/ldsodefs.h:  __attribute__ ((__noreturn__));
sysdeps/generic/ldsodefs.h:     __attribute__ ((__noreturn__));
sysdeps/generic/ldsodefs.h:     attribute_hidden __attribute__ ((__noreturn__));

sysdeps/htl/pthread.h:extern void pthread_exit (void *__status) __attribute__ ((__noreturn__));

sysdeps/htl/pthreadP.h:void __pthread_exit (void *value) __attribute__ ((__noreturn__));

sysdeps/htl/pthread-functions.h:void __pthread_exit (void *) __attribute__ ((__noreturn__));
sysdeps/htl/pthread-functions.h:  void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));

sysdeps/unix/sysv/linux/generic/____longjmp_chk.c:  __attribute__ ((__noreturn__));

sysdeps/unix/sysv/linux/s390/longjmp_chk.c:     __attribute__ ((__noreturn__));

sysdeps/unix/sysv/linux/i386/startup.h:__attribute__ ((__noreturn__))

sysdeps/unix/sysv/linux/ia64/__sigstack_longjmp.c:     __attribute__ ((__noreturn__));

sysdeps/x86/longjmp.c:     __attribute__ ((__noreturn__)) attribute_hidden;

sysdeps/powerpc/novmxsetjmp.h:     __attribute__ ((__noreturn__));
sysdeps/powerpc/novmxsetjmp.h:     __attribute__ ((__noreturn__));
sysdeps/powerpc/novmxsetjmp.h:     __attribute__ ((__noreturn__));
sysdeps/powerpc/novmxsetjmp.h:     __attribute__ ((__noreturn__));

sysdeps/pthread/threads.h:extern void thrd_exit (int __res) __attribute__ ((__noreturn__));

assert/assert.h:     __THROW __attribute__ ((__noreturn__));
assert/assert.h:     __THROW __attribute__ ((__noreturn__));
assert/assert.h:     __THROW __attribute__ ((__noreturn__));

nscd/nscd.h:extern void termination_handler (int signum) __attribute__ ((__noreturn__));
nscd/nscd.h:extern void start_threads (void) __attribute__ ((__noreturn__));
nscd/nscd.h:extern int receive_print_stats (void) __attribute__ ((__noreturn__));

nscd/connections.c:__attribute__ ((__noreturn__))
nscd/connections.c:__attribute__ ((__noreturn__))
nscd/connections.c:__attribute__ ((__noreturn__))

include/sys/cdefs.h:extern void __chk_fail (void) __attribute__ ((__noreturn__));

include/setjmp.h:     __attribute__ ((__noreturn__)) attribute_hidden;
include/setjmp.h:     __attribute__ ((__noreturn__)) attribute_hidden;

include/stdio.h:     __attribute__ ((__noreturn__));
include/stdio.h:extern void __fortify_fail (const char *msg) __attribute__ ((__noreturn__));

include/assert.h:     __THROW __attribute__ ((__noreturn__));
include/assert.h:     __THROW __attribute__ ((__noreturn__));
include/assert.h:     __THROW  __attribute__ ((__noreturn__)) attribute_hidden;

include/unistd.h:libc_hidden_proto (_exit, __noreturn__)
include/unistd.h:rtld_hidden_proto (_exit, __noreturn__)

misc/sys/cdefs.h:#  define _Noreturn __attribute__ ((__noreturn__))

misc/err.h:     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
misc/err.h:     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
misc/err.h:     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
misc/err.h:     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));

misc/bits/error.h:  __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));
misc/bits/error.h:  __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6)));

@GammaPi GammaPi changed the title Bug: Jmp functions not unhooked completely Jmp functions not unhooked completely Nov 28, 2021
@GammaPi GammaPi added the bug Something isn't working label Nov 28, 2021
@GammaPi GammaPi self-assigned this Nov 28, 2021
@GammaPi
Copy link
Member Author

GammaPi commented Nov 28, 2021

_setjmp is a missing one. If I don't unhook this, aget won't work

@GammaPi GammaPi closed this as completed Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant