From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753660AbbJaPZj (ORCPT ); Sat, 31 Oct 2015 11:25:39 -0400 Received: from smtp12.mail.ru ([94.100.181.93]:33851 "EHLO smtp12.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753587AbbJaPZh (ORCPT ); Sat, 31 Oct 2015 11:25:37 -0400 Subject: Re: [PATCH v2 1/4] x86/signal/64: Add a comment about sigcontext->fs and gs To: Andy Lutomirski , x86@kernel.org, linux-kernel@vger.kernel.org References: <66cb936904b7ce56ddc1ce58119bd9683e4f3b43.1445822498.git.luto@kernel.org> Cc: Brian Gerst , Denys Vlasenko , Linus Torvalds , Borislav Petkov From: Stas Sergeev Message-ID: <5634DD68.4090709@list.ru> Date: Sat, 31 Oct 2015 18:25:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <66cb936904b7ce56ddc1ce58119bd9683e4f3b43.1445822498.git.luto@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mras: Ok Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 26.10.2015 04:25, Andy Lutomirski пишет: > These fields have a strange history. This tries to document it. > > This borrows from 9a036b93a344 ("x86/signal/64: Remove 'fs' and 'gs' > from sigcontext"), which was reverted by ed596cde9425 ("Revert x86 > sigcontext cleanups"). > > Signed-off-by: Andy Lutomirski Now the strategy about SS is to always save it to the sigcontext. This is good because the syscall can clobber it, so the app had to be very careful in the past trying to save it by hands. How about saving also fs and gs? (without restoring yet) If you do, you'll save dosemu a headache of doing any "pre-syscall" work. Pre-syscall work is very nasty. I haven't checked if the syscall clobber also these or only SS, but perhaps saving them by the kernel won't hurt?