Received: by 10.213.65.68 with SMTP id h4csp276707imn; Wed, 21 Mar 2018 18:41:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELv9WfsAY6tKjNwjdpUrHq57yO4dgyG1NlrrWht2GKBkk/wjnGXYbnc4bKSJ3kmKbXapKjrN X-Received: by 2002:a17:902:43e4:: with SMTP id j91-v6mr5096255pld.118.1521682887423; Wed, 21 Mar 2018 18:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521682887; cv=none; d=google.com; s=arc-20160816; b=LMSXjneE5/i4cKyWO7vbhXGX/f5YbxHY5aK4gJF/kFfH1w1rFA0dgLgP/IGzI7qgHr pmse8NaRg3J1kY+cse27fPFcHiCjoP0+71qhm0epsmzpiI5WM2u+8JeU4YdXfWuiwf91 PmZxGeQ9bUbWsVWLhKc/Sn7fR0u3RXD7zo8bA1oVdp/ASuY28g1O6a/EWUpN6H/A7GHj iU0k5x4MRDPNN6OdITARe+sCXpa811mP7P0+W6734M76NLT1awlR2rds9/p7kFHGKnZO vHaj3fM8SKaxNI0oLgKczun/Lg2hOKWGZGMR9gtj9oYiFwX5p36szZdbCIbtCeEiKCgt bKsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=3DYBKAoCqBNPo0qggZnFgMu7w8HszRC8DvAMOk+U29k=; b=UGN3P3KIZ6yZVlViiVlkp3cLb+sNqRc35Fu+qBv2HU9OL4a2CN3IvT0rtLkwHo+8Ts 0l3P9TeHtV2omUdQ4GG4hdhl/5kzhPsAID8Zo20iyxVY/JErk4i/KodDqgq2L5Bv3YSc ISOxQB47aUN90oSHKZJf8JOzFTFXnovdpabEo4FvWjM2pyf5WkV1+JPbiHZKA1oltnuq /fdOVwkpeSUkSx/jcvZhl94reFD6odFBwClRl559BlpwVC0xDUfmmuPC02dvuScX/vW3 pmXVTkbVTl+4+lfYAmBcTN2DtmekX/GpSz+IXe8Ebf6ThX51PbTc++YZzTBWT7014obF gSnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v189si3666903pgb.374.2018.03.21.18.41.12; Wed, 21 Mar 2018 18:41:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754382AbeCVBkV (ORCPT + 99 others); Wed, 21 Mar 2018 21:40:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:52850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752527AbeCVBkU (ORCPT ); Wed, 21 Mar 2018 21:40:20 -0400 Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 885C92177A for ; Thu, 22 Mar 2018 01:40:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 885C92177A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-io0-f172.google.com with SMTP id m83so8957341ioi.8 for ; Wed, 21 Mar 2018 18:40:19 -0700 (PDT) X-Gm-Message-State: AElRT7Ha3LbY9jEXYKhBI35qilBfbzTB2shiJ2T0aTT6HboN8RyR8pBK YCLa9HhYnFpGPQOVG0f9BVs907kxTRxZt18yoQxvlw== X-Received: by 10.107.20.213 with SMTP id 204mr20318020iou.239.1521682818998; Wed, 21 Mar 2018 18:40:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.137.70 with HTTP; Wed, 21 Mar 2018 18:39:58 -0700 (PDT) In-Reply-To: References: <1521481767-22113-1-git-send-email-chang.seok.bae@intel.com> <1521481767-22113-15-git-send-email-chang.seok.bae@intel.com> From: Andy Lutomirski Date: Thu, 22 Mar 2018 01:39:58 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 14/15] x86/fsgsbase/64: Support legacy behavior when FS/GS updated by ptracer To: "Metzger, Markus T" Cc: Andy Lutomirski , "Bae, Chang Seok" , X86 ML , Andi Kleen , "H. Peter Anvin" , "Luck, Tony" , "Shankar, Ravi V" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 21, 2018 at 7:01 AM, Metzger, Markus T wrote: >> -----Original Message----- >> From: Andy Lutomirski [mailto:luto@kernel.org] >> Sent: 21 March 2018 01:47 > > Hello Andy, > >> I retract this particular comment. But I still think that all this complexity needs to >> be more clearly justified. My objection to the old approach wasn't that I thought >> it was obviously wrong -- I thought that someone needed to survey existing >> ptrace() users and see if anyone needed the fancier code that you're adding. Did >> you find something that needs this fancy code? > > There are 3 cases: > - only FS changed, e.g. "p $fs = ..." If a person literally types that, I have no problem if they get different behavior on different systems. If it's some existing program that needs to keep working, then we may be out of luck, since gdb seems to use SETREGS. > - only FS_BASE changed, e.g. "p $fs_base = ..." That's fine no matter what, I think. > - both change, e.g. "p foo()" when restoring the original register state on return > from the inferior call This is the interesting case. If everything that matters uses SETREGS, then I think we're in good shape, and we should probably just make writing to FS using ptrace on FSGSBASE systems *not* change FSBASE, since that way is much simpler.