Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2512247pxa; Mon, 24 Aug 2020 16:54:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx399/LkQjYoD1r0IkWvsT4EAkvJhAV3O55dMOE2AV/AlS4hjrSVrf2K+qpQ2LxG6Gzpd2H X-Received: by 2002:a17:906:7204:: with SMTP id m4mr3390618ejk.342.1598313246275; Mon, 24 Aug 2020 16:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598313246; cv=none; d=google.com; s=arc-20160816; b=X3TxTKVfyRRGUl/IbWZv3/3Dl8ScJubclgU2+nqQ1lbSqIFftkQy8MwAdoVFc+umCA T0s+E07y2IrAkVf9ewFhAOyRun7iSINbt/fBY37LmWasI7PNO2aiql592y99doqc2kTt h8n5+F/GcuuxphM5PWAcAucT+uiXJ8a8jzwnpS7DKPVK2ZeEFSvzOoMGRwMiXho1dgCo VFmp4p9XQHwHmsLB9IGfXgeJdYYUrFZr6kHX5Nj7gtO0klZVaU+bWB2EDfj21g5EsX7S eoLsAyVZGLM+zD2R08vEUHHuNADkSs1ipyZsaGBcP08D03y7JoCAxsj6wrDjcq2tBg6h C+dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature:dkim-filter; bh=JM6qo6j85EsiFGJo5bpjdiQ4d9EYsiab14JL4DBBCQI=; b=WUcgEGq4tVXKumlXQEBR3GipFTUvl4PuHnIF6oV/uEtloSG/viZNmCApOQTeGXsKY0 mNm7kZrsmoKVhWwq7SRhlw5dyGKaUUwj7QKsti6S1kHFHwNVq7bP/iXHMLIMYf8UpST7 SUWFym10BEk6nSAwf9Ycyh1gfInW/aUA5S+6dpxPf/PIMxV8ITQ9ATQkWpEWe7uRvzu2 Y2mL7xjfnxJQDuPXYwmiIse63npAUiyYHcCm/+pAxvgJV/lSIDmsXVuaxX5LNXodpV5x fAkY5wWo91ZBqr/OWHyvNNZ7CbwSafA4+2VEC5iX3EJaIrSAXusJOlNBNJaZePMtlBSx GyEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2020072401 header.b=i0hzNdiE; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v4si7818064ejb.563.2020.08.24.16.53.42; Mon, 24 Aug 2020 16:54:06 -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=fail header.i=@zytor.com header.s=2020072401 header.b=i0hzNdiE; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726531AbgHXXxM (ORCPT + 99 others); Mon, 24 Aug 2020 19:53:12 -0400 Received: from terminus.zytor.com ([198.137.202.136]:60013 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbgHXXxM (ORCPT ); Mon, 24 Aug 2020 19:53:12 -0400 Received: from carbon-x1.hos.anvin.org ([IPv6:2601:646:8600:3280:1098:42a1:36db:233c]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id 07ONqLRP2464825 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 24 Aug 2020 16:52:21 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 07ONqLRP2464825 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2020072401; t=1598313144; bh=JM6qo6j85EsiFGJo5bpjdiQ4d9EYsiab14JL4DBBCQI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=i0hzNdiE6BrFVawkgDXaHtoE+pTY37EXLlolpCHpcfbYjtMFclVq8ndCg9cj0Cjkn 5+R+2V/liasUhKg0uyO2epUJTZ5/u2g2vIPOVSGfRVX7eiAS+VJEivjdDmpo5krBcI T3/Ij8ID1Q8qWH57wS0xs3qnI3Tx4fl1bv4QgAJ0Nz42AvwvRqnwMFeIRoabG0rcg7 HumzkNZs2Rs9zuNy8i8Pdue31bd1zZaJhQKUhtlvG81pckGCniRzoIFwVrVVDiUtNg kvhXqiIpHroklTtMUELFOj+A/0SawIg6FU4x9ibV+AH7qfQZKp1Hg9gD6YBjPrWhex VGM/zfAhYCXBA== Subject: Re: [REGRESSION] x86/cpu fsgsbase breaks TLS in 32 bit rr tracees on a 64 bit system To: Andy Lutomirski , "Robert O'Callahan" Cc: "Bae, Chang Seok" , Kyle Huey , Thomas Gleixner , Ingo Molnar , Andi Kleen , "Shankar, Ravi V" , LKML , "Hansen, Dave" References: <7DF88F22-0310-40C9-9DA6-5EBCB4877933@amacapital.net> From: "H. Peter Anvin" Message-ID: Date: Mon, 24 Aug 2020 16:52:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -hpa