From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Stancek Date: Thu, 3 Jan 2019 06:00:58 -0500 (EST) Subject: [LTP] [PATCH] syscalls/ptrace07: handle potential SIGSEGV on older kernels In-Reply-To: References: Message-ID: <949898479.93116882.1546513258421.JavaMail.zimbra@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it ----- Original Message ----- > On Fri, Dec 21, 2018 at 9:51 PM Jan Stancek wrote: > > > > If a ptraced test process hits SIGSEGV, the entire testcase hangs. > > > > Older kernels such as RHEL7 (3.10.0), check the error code returned > > by restore_fpu_checking() and do drop_init_fpu() if it fails. > > So the FPU state of the prev task can't leak. > > > > But in the more likely case a task with xcomp_bv != 0 will be killed > > by SIGSEGV; either from do_device_not_available() or from > > sys_rt_sigreturn()->__restore_xstate_sig(). > > > > And this is why the test case hangs; it wrongly assumes that the > > traced child can only exit and report nothing else. But since it > > receives SIGSEGV it reports this signal to the main process and > > sleeps in ptrace_stop(), it does not exit and thus the test-case > > hangs in tst_reap_children() after return from do_test(). > > > > Replace PTRACE_CONT with PTRACE_DETACH, so we don't need to > > handle subsequent stops. And treat exit code from test process > > as info-only. > > ptrace07(with this patch applied) passed with kernel 3.10 and 4.18 > multi arches test. > > > > > Debugged-by: Oleg Nesterov > > Signed-off-by: Jan Stancek > > Tested-by: Li Wang Pushed. Regards, Jan