From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756797AbbCRSG1 (ORCPT ); Wed, 18 Mar 2015 14:06:27 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:35698 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756327AbbCRSGY (ORCPT ); Wed, 18 Mar 2015 14:06:24 -0400 MIME-Version: 1.0 In-Reply-To: <20150318174843.GA32238@redhat.com> References: <405594361340a2ec32f8e2b115c142df0e180d8e.1426193719.git.luto@kernel.org> <20150318174843.GA32238@redhat.com> From: Andy Lutomirski Date: Wed, 18 Mar 2015 11:06:00 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] x86_64,signal: Fix SS handling for signals delivered to 64-bit programs To: Oleg Nesterov Cc: Andrey Wagin , Andy Lutomirski , Ingo Molnar , Andi Kleen , "H. Peter Anvin" , Al Viro , X86 ML , LKML , Linus Torvalds , Borislav Petkov , Cyrill Gorcunov , Pavel Emelyanov Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 18, 2015 at 10:48 AM, Oleg Nesterov wrote: > On 03/18, Andrey Wagin wrote: >> >> This commit breaks CRIU. I don't have any details yet. I'm going to >> investigate this issue and provide more details tomorrow. >> >> [root@avagin-fc19-cr criu]# setsid sleep 1000 & >> [1] 1225 >> [root@avagin-fc19-cr criu]# ps -C sleep >> PID TTY TIME CMD >> 1226 ? 00:00:00 sleep >> [root@avagin-fc19-cr criu]# ./criu dump -t 1226 -D dump --shell-job >> [root@avagin-fc19-cr criu]# ./criu restore -D dump --shell-job >> Error (parasite-syscall.c:923): Task is in unexpected state: b7f (SIGSEGV) > > This is funny. Because currenty I am looking into criu sources for quite > different reason (and I HATE this reason ;) > > Shot in a dark afer a quick grep: restore_gpregs() should initialize ->ss? > > perhaps something like below... obviously uncompiled/untested. > > And my grep can't find the definition of UserX86RegsEntry in crtools... > Perhaps the change below needs CPREG1(ss, anothername). > > Seriously, where is UserX86RegsEntry? > > Oleg. > > > --- a/arch/x86/crtools.c > +++ b/arch/x86/crtools.c > @@ -475,6 +475,7 @@ int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r) > CPREG2(rip, ip); > CPREG2(eflags, flags); > CPREG1(cs); > + CPREG1(ss); > CPREG1(gs); > CPREG1(fs); Huh? Is CRIU actually trying to build an entire sigcontext from scratch here? I don't see how this can reliably work across kernel versions or CPU versions. Also, what's up with CPREG1(gs) and CPREG1(fs)? I assume that's redundant, because that hasn't worked for many years, but CRIU works, so there must be correct code somewhere to restore those regs. --Andy