From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754167AbcEBP37 (ORCPT ); Mon, 2 May 2016 11:29:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51520 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753965AbcEBP3n (ORCPT ); Mon, 2 May 2016 11:29:43 -0400 Date: Mon, 2 May 2016 16:27:46 +0200 From: Oleg Nesterov To: Andy Lutomirski Cc: X86 ML , "linux-kernel@vger.kernel.org" , Roland McGrath , Andi Kleen , Borislav Petkov , Brian Gerst Subject: Re: ptrace vs FSGSBASE Message-ID: <20160502142746.GA7142@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, let me first say that I never knew how this code (and the hardware) actually works, I am not sure I even understand what ARCH_SET_.S exactly does ;) What is even worse, I do not understand your question. So it is not that I am trying to help, I am asking you to help me understand the problem. On 04/29, Andy Lutomirski wrote: > > 1. I read fs_base using ptrace. I think I should get the actual > fs_base without any nonsense. Which fs_base? The member of user_regs_struct? But this structure/layout is just the ABI, so to me it seems correct that getreg() tries to look at ->fs and/or ->fsindex. IOW. getreg(fs) should return the same value as prctl(ARCH_GET_FS) returns if called by the tracee, no? > 2. I read all the regs (PEEKUSER or whatever) and then write then all > back verbatim. At the very least, I think that if I do this > atomically using PTRACE_SETREGSET, the task's state needs to remain > unchanged. Agreed... do you mean this doesn't work? > Since ptrace doesn't seem to have any real concept of > atomic register state changes right now Could you spell please? I can't understand what does "atomically" mean in this context. Oleg.