Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4398020ybb; Tue, 14 Apr 2020 06:34:51 -0700 (PDT) X-Google-Smtp-Source: APiQypKENU2mTT3G4cyFwjqwPw+8YkT9fGzCu+MXFnvRA94o6sK2oww3Ag0AuqvAkK+gf08EsP4r X-Received: by 2002:a17:906:c4f:: with SMTP id t15mr92928ejf.193.1586871291483; Tue, 14 Apr 2020 06:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586871291; cv=none; d=google.com; s=arc-20160816; b=kizRjCrKyfGirhtAEek2/B51/qKyxEhkK/HVIaZ03JSHbXtEwfzOpp7aDjgyCqpMoG WmxtGh6vt1nZu/twBPMBm9N3GMWaKPnxV11pSvM941rckTl/XtiCcHHN2BlapBrKkBWx tq2P3/evNk4HyxHTYXRVNgmfndUlBREx+xFXatjD7Af/rAPEHMwt8gXC2/60tQfeZR4k QaHb4VErOHNcricw+i5ZHIbXcPVEniMjQBKNwm6uaoBruVSfJ9EhtnBveBN0vVBuf9a2 uVdDfVXqUSSFt2MxPxF1X2cVLIKcqLw1SoCcbAuItVNjOhHms1YzJC/KkhlktIXR28xw xhsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vDWEFFjx2D7SDG5KIt/QhwRjO2G8jMmPbQ3jckyWdv4=; b=ld2OVXZvwrUXDvAWsVPnyxpDf1zjDQlmPjaor1RqwN98S3U7GJOuYtW2PjCEhLmioC E8qBKwL6uAiP9ZCTgsoJqBkywdcZZwxf9vKxUR8iKOWKhirn3hESnhAVF6PsEc91VlLH emCQM60fmwnR0TRTyJVgaWOKmYa7efqvddktRNB7/+PZPs5qcg69ND5XfoC6YlfuFDWp qemCQ5ki5BneD4wc7QeiOl0heu15ITHzrB7LLfgIYjRNh7q0S1R8ylJvsHVER/fWOu4y jmNEMP0yv+A1+VjtJWlAQcOsFabiamDIhtqY45JQO+NUwcSPDmVuWF/RVasy1Rdk4EVt LfIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yh8bmdrK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si2065770ejs.38.2020.04.14.06.34.28; Tue, 14 Apr 2020 06:34:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yh8bmdrK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388217AbgDMUDk (ORCPT + 99 others); Mon, 13 Apr 2020 16:03:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:36124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388207AbgDMUDi (ORCPT ); Mon, 13 Apr 2020 16:03:38 -0400 Received: from localhost (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C301020656; Mon, 13 Apr 2020 20:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586808218; bh=8JRSPtfFtwYpSXe+i9+/qeDQ6wtXz30+2CN05Ky2K6c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Yh8bmdrKCvHdJ3KwdaOzWcbYWbjRFePxlpjXNzEDybKoB30og5rJZe1DikW0Z7Orw tvW9XV3nzIAO3u+utBZZC1ivs0JF5PO2gbC63YJV/8Z8cMWhp6Z35K2cK6D3VIhMpq +p3L9RaTVEoaU4iDjjUZRy5e7yRw1Lz9Hd+7LSvQ= Date: Mon, 13 Apr 2020 16:03:36 -0400 From: Sasha Levin To: "Bae, Chang Seok" Cc: Andy Lutomirski , "Metzger, Markus T" , Andi Kleen , "hpa@zytor.com" , Thomas Gleixner , "bp@alien8.de" , "Hansen, Dave" , "Luck, Tony" , Pedro Alves , Simon Marchi , "Shankar, Ravi V" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v9 00/17] Enable FSGSBASE instructions Message-ID: <20200413200336.GA11216@sasha-vm> References: <1570212969-21888-1-git-send-email-chang.seok.bae@intel.com> <20191115191200.GD22747@tassilo.jf.intel.com> <29FD6626-4347-4B79-A027-52E44C7FDE55@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <29FD6626-4347-4B79-A027-52E44C7FDE55@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 24, 2020 at 06:02:17PM +0000, Bae, Chang Seok wrote: > >> On Dec 4, 2019, at 12:20, Andy Lutomirski wrote: >> >> I think it could make sense to add a whole new ptrace() command to >> tell the tracee to, in effect, MOV a specified value to a segment >> register. This call would have the actual correct semantics in which >> it would return an error code if the specified value is invalid and >> would return 0 on success. And then a second ptrace() call could be >> issued to read out FSBASE or GSBASE if needed. Would this be useful? >> What gdb commands would invoke it? > >We consider new commands to access GDT/LDT that hpa posted before [1] may be >helpful. If the kernel provides the interfaces to ptracer, we expect GDB for >both 32-/64-bits can make such changes for inferior calls: >(1) When FS/GS selector only updated, > GDB used to write the selector value via SETREGS. Now it can read the > base value from the new APIs and write the base also. This change does > not harm today's kernel, and it retains the legacy behavior on > FSGSBASE-enabled kernels in the future. >(2) When FS/GS base only updated, >(3) When both FS/GS selector and base updated, > GDB has no change from what it used to do. The new FSGSBASE-enabled > kernel improves the behavior by keeping the base regardless of a > selector. > >The proposed change in GDB would do an additional GETREGS for every SETREGS >to obtain the old value. Other ptrace-users may need a similar patch if >sensitive to the outcome from writing FS/GS selector, but last time when we >surveyed for other tools [2, 3], we didn't find the issue. We also didn't >find actual users who rely on legacy behavior in practice. > >We'd like to hear a clear opinion of whether the GDB changes along with the >new ptrace APIs are necessary and sufficient as preparing the FSGSBASE >support in the kernel. Hi folks, Let me try to revive this work as I think that it's blocked due to misunderstanding of the current situation. What I gather from the Intel folks is that the GDB folks are okay with the change as is and don't expect to be doing any changes on their end. The intel folks are interested in resolving this, but haven't heard back on their proposed plan (above). Thomas/Andy want to make sure that we are doing the right thing and are not breaking anything: 1. The ptrace modifications are correct (we do the right thing around updating FS/GS). 2. The ptrace changes don't break existing userspace. I think that the Intel folks confirmed it above. Is my attempt at understanding the current situation correct? -- Thanks, Sasha