Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752002AbbHMIj4 (ORCPT ); Thu, 13 Aug 2015 04:39:56 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:37964 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbbHMIjx (ORCPT ); Thu, 13 Aug 2015 04:39:53 -0400 Date: Thu, 13 Aug 2015 10:39:49 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: Stas Sergeev , X86 ML , Linux kernel , Linus Torvalds , "H. Peter Anvin" , Thomas Gleixner , Brian Gerst , Borislav Petkov Subject: Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu Message-ID: <20150813083949.GA17091@gmail.com> References: <55CBA4CE.1040108@list.ru> <55CBA909.3020306@list.ru> <55CBB053.7050803@list.ru> <55CBB2CC.9090600@list.ru> <55CBBFB9.1080201@list.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2128 Lines: 60 * Andy Lutomirski wrote: > > OK. > > I'll try to test the patch tomorrow, but I think the sigreturn()'s > > capability detection is still needed to easily replace the iret trampoline > > in userspace (without generating a signal and testing by hands). > > Can of course be done with a run-time kernel version check... > > That feature is so specialized that I think you should just probe it. > > void foo(...) { > sigcontext->ss = 7; > } > > modify_ldt(initialize descriptor 0); > sigaction(SIGUSR1, foo, SA_SIGINFO); > if (ss == 7) > yay; > > Fortunately, all kernels that restore ss also have espfix64, so you > don't need to worry about esp[31:16] corruption on those kernels > either. > > I suppose we could add a new uc_flag to indicate that ss is saved and restored, > though. Ingo, hpa: any thoughts on that? There will always be some kernel > versions that save and restore ss but don't set the flag, though. So this new flag would essentially be a 'the ss save/restore bug is fixed for sure' flag, not covering old kernels that happen to have the correct behavior, right? Could you please map out the range of kernel versions involved - which ones: - 'never do the right thing' - 'do the right thing sometimes' - 'do the right thing always, but by accident' - 'do the right thing always and intentionally' ? I'd hate to complicate a legacy ABI any more. My gut feeling is to let apps either assume that the kernel works right, or probe the actual behavior. Adding the flag just makes it easy to screw certain kernel versions that would still work fine if the app used actual probing. So I don't see the flag as an improvement. If your patch fixes the regression that would be a good first step. Please also send the fix in email instead of just pointing to a Git tree, so that people can comment on it. Thanks, Ingo -- 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/