Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2530869pxa; Mon, 24 Aug 2020 17:33:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGzIoMHubRxUPfkdbLsWWxyilus8TIJAZtuZ+So4aVJZYGRTAh1Lf6EkoATaQUd4Qrjap7 X-Received: by 2002:a50:aadd:: with SMTP id r29mr7762572edc.219.1598315591560; Mon, 24 Aug 2020 17:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598315591; cv=none; d=google.com; s=arc-20160816; b=gYAHYQMuiZ5fOFlyAKyB9Wx97D8LgHsCofKa6XfCigqGtnTHbPvwx8Bl5L9DMSikCp 2t+tMwSzs5d0ss9fKvA604b2Fn0UorXzQMO/P3yl3Mw8Fyg5HYrMlmKZAhGzFSeZZTN+ GMrDSAelET+gluwQLFm7XqM5UrfuyKLJQedUKwJ/wc+kbp/sfZjnuM2e8pLsY8uQoVAH F0gUZJq4rQQ/lXikHwT8WlzmxIQDvKkXDY6OXSg3iD8yv69yLzVvllEOq17KxlFTQghN 0UqMNfuQV/3Ni2GB7rsSnmqGLvgiyx/YKhSTNowFY/X5qTlfdVnhQeAYfaBwmk/K1nRD xYsw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=bIPhkiRgS4CEIAvZlwVuqjGpNnZ5S2tbYOK/pynfZCE=; b=pQJkNGgaS7NAW/9Q8V3o2df99E3sVG8vwq/l42jmCT3G0/QaB5/tdIuuHR2vfTbGPL 63soRtTHASg4H4wMkQjiomWy7WkMaEVdNU2y3CIpwgBVht/EQ2AgtB8YQOTaxQgpBmlu RXOnPjYaVcIKvDreF7Z2k+gO4aTglii4uyEY+6roIYQQP3lBVWoN+xw8epSTdepzpFNv XNMimzJn1OlLGDAYtkCD3JD93lrjrG09mrzzpBXN9HIBhN/wdAR3FsqDj6UoPmd297XG MCpxkw0fKBJBPRcAuFhE53EGdjtUxGad8v2ED+XRulbtA6mtLTCMQx/1M1Ed436RPxPd 4ggA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QPla5Imz; spf=pass (google.com: 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 h13si1365598eds.293.2020.08.24.17.32.48; Mon, 24 Aug 2020 17:33:11 -0700 (PDT) Received-SPF: pass (google.com: 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=QPla5Imz; spf=pass (google.com: 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 S1728562AbgHYAbQ (ORCPT + 99 others); Mon, 24 Aug 2020 20:31:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:35266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728386AbgHYAbL (ORCPT ); Mon, 24 Aug 2020 20:31:11 -0400 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 2D7A620882 for ; Tue, 25 Aug 2020 00:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598315470; bh=tq8BpZywkVUDyXkA8BuG2zK2VdJBulYjB7aXNUE6TAA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QPla5ImzONRb+P8ymGn9z0BfaEu5OG7pVsmt9F9Sj8YwbJlHjRpc4wLh1Ds0Ea8ks 2mBCru4/9A2H/ilPXRWIx/x/FB71V+jahaZZ6j85xes/nk6nRh16VzD9M11GzXaXpu 7WUgbAe8DpOgpoUqiinpjXLmeQj1fawBmKB2Etck= Received: by mail-wm1-f53.google.com with SMTP id c19so577453wmd.1 for ; Mon, 24 Aug 2020 17:31:10 -0700 (PDT) X-Gm-Message-State: AOAM530JM1XZbj8a+Buv0102pGiSXIjvFnDD8jpBp4KUSEXqkq+ArDMA D8CPBHVhIUz73ENQtA6SkCOSJURipvigB361+eh/Tw== X-Received: by 2002:a1c:4c06:: with SMTP id z6mr1611443wmf.21.1598315468706; Mon, 24 Aug 2020 17:31:08 -0700 (PDT) MIME-Version: 1.0 References: <7DF88F22-0310-40C9-9DA6-5EBCB4877933@amacapital.net> In-Reply-To: From: Andy Lutomirski Date: Mon, 24 Aug 2020 17:30:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [REGRESSION] x86/cpu fsgsbase breaks TLS in 32 bit rr tracees on a 64 bit system To: "H. Peter Anvin" Cc: Andy Lutomirski , "Robert O'Callahan" , "Bae, Chang Seok" , Kyle Huey , Thomas Gleixner , Ingo Molnar , Andi Kleen , "Shankar, Ravi V" , LKML , "Hansen, Dave" 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 Mon, Aug 24, 2020 at 4:52 PM H. Peter Anvin wrote: > > On 2020-08-24 14:10, Andy Lutomirski wrote: > > > > PTRACE_READ_SEGMENT_DESCRIPTOR to read a segment descriptor. > > > > PTRACE_SET_FS / PTRACE_SET_GS: Sets FS or GS and updates the base accordingly. > > > > PTRACE_READ_SEGMENT_BASE: pass in a segment selector, get a base out. > > You would use this to populate the base fields. > > > > or perhaps a ptrace SETREGS variant that tries to preserve the old > > base semantics and magically sets the bases to match the selectors if > > the selectors are nonzero. > > > > Do any of these choices sound preferable to any of you? > > > > My suggestion would be to export the GDT and LDT as a (readonly or mostly > readonly) regset(s) rather than adding entirely new operations. We could allow > the LDT and the per-thread GDT entries to be written, subject to the same > limitations as the corresponding system calls. > That seems useful, although we'd want to do some extensive sanitization of the GDT. But maybe it's obnoxious to ask Kyle and Robert to parse the GDT, LDT, and selector just to emulate the demented pre-5.9 ptrace() behavior. --Andy