From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755062AbdC1Q20 (ORCPT ); Tue, 28 Mar 2017 12:28:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32884 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752309AbdC1Q2X (ORCPT ); Tue, 28 Mar 2017 12:28:23 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F616C054915 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=oleg@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8F616C054915 Date: Tue, 28 Mar 2017 18:27:37 +0200 From: Oleg Nesterov To: Andy Lutomirski Cc: Andrew Morton , Linus Torvalds , Denys Vlasenko , "H. Peter Anvin" , Ingo Molnar , Jan Kratochvil , Pedro Alves , Thomas Gleixner , X86 ML , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/1] get_nr_restart_syscall() should return __NR_ia32_restart_syscall if __USER32_CS Message-ID: <20170328162736.GA3983@redhat.com> References: <20170328145413.GA3164@redhat.com> <20170328145432.GA3163@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 28 Mar 2017 16:27:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/28, Andy Lutomirski wrote: > > On Tue, Mar 28, 2017 at 7:54 AM, Oleg Nesterov wrote: > > get_nr_restart_syscall() checks TS_I386_REGS_POKED but this bit is only > > set if debugger is 32-bit. If a 64-bit debugger restores the registers > > of a 32-bit debugee outside of syscall exit path get_nr_restart_syscall() > > wrongly returns __NR_restart_syscall. > > I had sent a patch that introduced a new syscall nr, but it's not > quite safe because it could break seccomp-using programs. Ah, indeed... > But your > patch here is also screwy. Yes, yes, it doesn't try to solve all possible problems, I even mentioned this in the changelog. > How about we store the syscall arch to be restored in task_struct > along with restart_block? Yes, perhaps we will have to finally do this. Not really nice too. > the way there without heuristics as nasty as yours. I agree it will be better, but I refuse to treat them as mine checks ;) > P.S. __USER32_CS is the wrong check even if we used your approach. > user_64bit_regs() is much better. Yes, thanks. If only I understood what cs == pv_info.extra_user_64bit_cs actually means... OK, please ignore this patch, I'll try to make another fix. Oleg.