From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757332AbbCMQPL (ORCPT ); Fri, 13 Mar 2015 12:15:11 -0400 Received: from mail.skyhub.de ([78.46.96.112]:34419 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753839AbbCMQPH (ORCPT ); Fri, 13 Mar 2015 12:15:07 -0400 Date: Fri, 13 Mar 2015 17:13:38 +0100 From: Borislav Petkov To: Andy Lutomirski Cc: Ingo Molnar , Andi Kleen , "H. Peter Anvin" , Al Viro , x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Oleg Nesterov , Andy Lutomirski Subject: Re: [PATCH v3 1/2] x86_64,signal: Fix SS handling for signals delivered to 64-bit programs Message-ID: <20150313161338.GC30678@pd.tnic> References: <405594361340a2ec32f8e2b115c142df0e180d8e.1426193719.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <405594361340a2ec32f8e2b115c142df0e180d8e.1426193719.git.luto@kernel.org> 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 On Thu, Mar 12, 2015 at 01:57:51PM -0700, Andy Lutomirski wrote: > From: Andy Lutomirski > > The comment in the signal code says that apps can save/restore other > segments on their own. It's true that apps can *save* SS on their > own, but there's no way for apps to restore it: SYSCALL effectively > resets SS to __USER_DS, so any value that user code tries to load > into SS gets lost on entry to sigreturn. > > This recycles two padding bytes in the segment selector area for SS. > > While we're at it, we need a second change to make this useful. If > the signal we're delivering is caused by a bad SS value, saving that > value isn't enough. We need to remove that bad value from the regs > before we try to deliver the signal. Oddly, x32 already got this > right. > > I suspect that 64-bit programs that try to run 16-bit code and use > signals will have a lot of trouble without this. > > Signed-off-by: Andy Lutomirski Acked-by: Borislav Petkov -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --