Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753298AbbHMQKL (ORCPT ); Thu, 13 Aug 2015 12:10:11 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:35150 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbbHMQKK convert rfc822-to-8bit (ORCPT ); Thu, 13 Aug 2015 12:10:10 -0400 MIME-Version: 1.0 In-Reply-To: <55CCBFDC.5000207@list.ru> References: <55CBA4CE.1040108@list.ru> <55CBA909.3020306@list.ru> <55CBB053.7050803@list.ru> <55CBB2CC.9090600@list.ru> <55CBBFB9.1080201@list.ru> <20150813083949.GA17091@gmail.com> <55CC911D.3080607@list.ru> <55CCB625.3000900@list.ru> <55CCBFDC.5000207@list.ru> From: Andy Lutomirski Date: Thu, 13 Aug 2015 09:09:49 -0700 Message-ID: Subject: Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu To: Stas Sergeev Cc: Ingo Molnar , X86 ML , Linux kernel , Linus Torvalds , "H. Peter Anvin" , Thomas Gleixner , Brian Gerst , Borislav Petkov , Stas Sergeev Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1939 Lines: 43 On Thu, Aug 13, 2015 at 9:03 AM, Stas Sergeev wrote: > 13.08.2015 18:38, Andy Lutomirski пишет: >> >> >> So... what do we do about it? We could revert the whole mess. We >> could tell everyone to fix their DOSEMU, which violates policy and is >> especially annoying given how much effort we've put into keeping >> 16-bit mode fully functional lately. We could add yet more heuristics >> and teach sigreturn to ignore the saved SS value in sigcontext if the >> saved CS is 64-bit and the saved SS is unusable. > > Andy, why do you constantly ignore the proposal to make > new behaviour explicitly controlable? You don't have to agree > with it, but you could at least comment on that possibility > and/or mention it with the ones you listed above. I'm not sure what the proposal is exactly. We could add a new uc_flags flag. If set, it means that sigcontext->ss is valid and should be used by sigreturn. If clear, then we ignore sigcontext->ss and just restore __USER_DS. The problem is that, by itself, this won't fix old DOSEMU. We somehow need to either detect that something funny is going on or just leave the flag clear by default. We could do this: always save SS to sigcontext->ss, but only restore sigcontext->ss if userspace explicitly sets the flag before sigreturn. If we do that, we'd need to also add my patch to preserve the actual HW SS selector if possible so that old DOSEMU knows what SS to program into its trampoline. This at least lets *new* DOSEMU set the flag and get the improved behavior. I still don't know what effect it'll have on Wine and CRIU. Stas, is that what you were thinking, or were you thinking of something else? --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/