cobalt: Allow tasks with non-locked memory
RFC PATCH 1/1 cobalt: Allow tasks with non-locked memory
libsanitizer intercepts mlockall() and makes it a nop. Handle this case here to allow debugging Xenomai applications with ASAN and friends.
While fixing Linux or libsanitizer would be the prettiest approach, making cobalt less strict regarding VM_LOCKED is the most practical way to get libsanitizer work with Xenomai.
---
Hi!
I'm using a variant of this patch to utilize ASAN/UBSAN to test in-house Xenomai applications.
libsanitizer seems do disable mlockall() due to a Linux bug:
https://github.com/gcc-mirror/gcc/blob/master/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc#L5982
Thanks,
//richard
--- kernel/cobalt/posix/process.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
kernel/cobalt/posix/process.c +3 -5
@@ -579,11 +579,9 @@ static inline int disable_ondemand_memory(void)siginfo_t si;if ((p->mm->def_flags &VM_LOCKED ) ==0 ) { -memset (&si,0 ,sizeof (si)); - si.si_signo =SIGDEBUG ; - si.si_code =SI_QUEUE ; - si.si_int =SIGDEBUG_NOMLOCK | sigdebug_marker; -send_sig_info (SIGDEBUG , &si, p); +printk (XENO_WARNING +"%s[%d] Task without VM_LOCKED, latencies expected!\n" , + current->comm,task_pid_nr (current));return 0 ; }
Signature · 1 line
2.16.4
Quoted 34 lines · Richard Weinberger via Xenomai
libsanitizer intercepts
mlockall()and makes it a nop. Handle this case here to allow debugging Xenomai applications with ASAN and friends.While fixing Linux or libsanitizer would be the prettiest approach, making cobalt less strict regarding
VM_LOCKEDis the most practical way to get libsanitizer work with Xenomai.Signed-off-by Richard Weinberger <[email protected]>---
Hi!I'm using a variant of this patch to utilize ASAN/UBSAN to test in-house Xenomai applications.
libsanitizer seems do disable
mlockall()due to a Linux bug:
https://github.com/gcc-mirror/gcc/blob/master/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc#L5982Thanks,
//richard--- kernel/cobalt/posix/process.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)kernel/cobalt/posix/process.c +0
-1@@ -579,11 +579,9 @@ static inline int disable_ondemand_memory(void)siginfo_t si;if ((p->mm->def_flags &VM_LOCKED ) ==0 ) { -memset (&si,0 ,sizeof (si));
kernel/cobalt/posix/process.c static inline int disable_ondemand_memory(void) · line 587
Quoted 10 lines
kernel/cobalt/posix/process.c +3
-4- si.si_signo =SIGDEBUG ; - si.si_code =SI_QUEUE ; - si.si_int =SIGDEBUG_NOMLOCK | sigdebug_marker; -send_sig_info (SIGDEBUG , &si, p); +printk (XENO_WARNING +"%s[%d] Task without VM_LOCKED, latencies expected!\n" , + current->comm,task_pid_nr (current));return 0 ; }
Why not simply installing a signal handler in the application that swallows this reason for SIGDEBUG when it's under libsanitizer controller? Or setting the whole signal on ignore?
Jan
----- Ursprüngliche Mail -----
Quoted 3 lines
Why not simply installing a signal handler in the application that swallows this reason for SIGDEBUG when it's under libsanitizer controller? Or setting the whole signal on ignore?
Simply because I was not sure whether I'm allowed to steal SIGDEBUG from Xenomai since it installs its own signal handler.
If installing my own handler is the preferred way, I'm happy. One patch less to carry around. :-)
Thanks,
//richard
Quoted 9 lines · Richard Weinberger
----- Ursprüngliche Mail -----
Quoted 3 lines
Why not simply installing a signal handler in the application that swallows this reason for SIGDEBUG when it's under libsanitizer controller? Or setting the whole signal on ignore?
Simply because I was not sure whether I'm allowed to steal SIGDEBUG from Xenomai since it installs its own signal handler.
If installing my own handler is the preferred way, I'm happy. One patch less to carry around. :-)
libcobalt only installs a fallback handler that does reporting. There is no issue adding your own. Rather, it's the normal pattern when the application wants to react on the various debug reasons.
Jan