UTSASRG / Scaler

GNU General Public License v2.0
4 stars 0 forks source link

Jmp functions not unhooked completely #4

Closed GammaPi closed 2 years ago

GammaPi commented 2 years ago

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 commented 2 years ago

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