Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1769639pxa; Thu, 20 Aug 2020 21:44:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPZcp4zgXSzDLk2DIi6lyRsG03EBCtTnhcSi+v7uWIeiw2Y00UrU8unmaNKVD1DyJ531sx X-Received: by 2002:a17:907:36b:: with SMTP id rs11mr1197255ejb.544.1597985052084; Thu, 20 Aug 2020 21:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597985052; cv=none; d=google.com; s=arc-20160816; b=MOju27LIpyTeEe5j/TfAab5ojzCQRx70NlQbzKJR9TpHghkCHXA4eM0Zam9L/AhoFa gEPXKJhpeCR2wNjlS8uwIWLzV1X8WcUf+yjqS7fPSFF/u6ttM2XxGyfYWUTYscXFybMI HbAf46IDHsnIZTrDRggjfSYyqezBAI4cPXnfLBdPUvWZqIGYr3adYnc3SJrawRAELJjq PmAQ6pG7pemz1t1/34DIIBtNwKXgQYgRu/YHRXHJveLbaMaAiwvAy7HxLYU/0bor87P2 ftwVGxK3QVyaj0bS/e6V7soWqq0o7Bf3kUoAqUC9fKoZOpg9EccKVMoOU50qDWmN52Qj T8wA== 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 :mime-version:dkim-signature; bh=9O3MOiDp9rTX/OUCaY8nDp9xXXYuY9V/2TPMnqT2hvc=; b=kc0tVLjPoYFeKRZpQfeh+9Hsxc7cFxMDfhAqMObUOKbDyD5fQ2tXcjpZ+IslP/Znum DRvyxcUhtP1fL7lTbPfBZQTHxrcuL4oR7zHt9Jwp6i6IzxseJfLNms8+6OdkkkR77BCg a7otNsz9klxjtRvIrD503rBY+qt8k/ZnhHQFksne/eDKPCsD0ofvKHSZULvGKgM2YIb4 dFAheHhRYb+l9AK3ShqEswziZBklNUUc4n93B6Da23B3BMA/tMmTyoGV5vOufg5Jc5aC Nwq99s0wP3O+7YDK7QFw+m8qHY1HX0ee/wb2VaRqtQbWpcj5E5uPdUvjUlrrJ5lz3UIL 99Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kylehuey.com header.s=google header.b=j+bAChCZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i20si418950ejh.394.2020.08.20.21.43.48; Thu, 20 Aug 2020 21:44:12 -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=@kylehuey.com header.s=google header.b=j+bAChCZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbgHUEmA (ORCPT + 99 others); Fri, 21 Aug 2020 00:42:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725270AbgHUEl6 (ORCPT ); Fri, 21 Aug 2020 00:41:58 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB5D8C061385 for ; Thu, 20 Aug 2020 21:41:57 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id a26so822294ejc.2 for ; Thu, 20 Aug 2020 21:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; h=mime-version:from:date:message-id:subject:to:cc; bh=9O3MOiDp9rTX/OUCaY8nDp9xXXYuY9V/2TPMnqT2hvc=; b=j+bAChCZOvr8+x9F5KYZlfXGuG/C1Hty9S4BYamev2FciN/J4qfwUh4dL+o+jdFZQg 4kUcC8qlulB4/ORHqo03FLFE93hwVr65vNgZZ6/QqnvkOt9ttQ9NrKUr/57jwZPrPTwl xhh3eFDqmRJPumperCORRHgWRLkBKUBDKt3PJnFWIG3d3GoZM/JD4sj+K0zEvlPHT/iR +6zGZc08nGgzMtQ9/prgqhPiWwOKCcdT11Dih2pEq7MQyc/XIXakovP+iN8KsLcCn6UG kBWkskSAb7rFa/qRjbZzfm5btwrXRxEn7/CvJ63BBELOCvD+xG+h1ZFFxg2Ajnoepv1u H0hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=9O3MOiDp9rTX/OUCaY8nDp9xXXYuY9V/2TPMnqT2hvc=; b=NjnuSMw+w3w+dNxIZUNuVQwRVOQK6N2SDAHNnNmxUKKHddbqgF7KoW9lTyypqrydMv 8f5XFIet48jO7rGETjZcXhxOyTZjQoTwfvhgRS4f6pdnWWYSctr4UXkTnWqyqBxYIntz OGt77FRjSlhHxSqEs3NyBfKx+bYvoQXBPP9vg3x2k37LQ5g/VQTyz+REJ5sZLRKnXzY5 ZBLDLm2SMP+5GrkuP/KlnxyG+3ClzSv6mbYoJiM1e7B5SlSXk2t+DpId5ta0Ys1ZfgJ+ ztKyjwJMa5eLNfBSjXTaBsJrTXPaUb63YfmC3Xt5MUvIFx0XjMATordPgvC+FbZWtFVf mapg== X-Gm-Message-State: AOAM533APt27AxCJCBqhb+sLRi4rdq2AvPqByKjCfzuF+If5AEKdUzF8 FXzvZe8+t7+hj+1R4yVbD9qGDq+cQ4Q7iiOIpIy0fg== X-Received: by 2002:a17:906:401b:: with SMTP id v27mr1146910ejj.300.1597984916441; Thu, 20 Aug 2020 21:41:56 -0700 (PDT) MIME-Version: 1.0 From: Kyle Huey Date: Thu, 20 Aug 2020 21:41:45 -0700 Message-ID: Subject: [REGRESSION] x86/cpu fsgsbase breaks TLS in 32 bit rr tracees on a 64 bit system To: Andy Lutomirski , "Chang S. Bae" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andi Kleen Cc: "Robert O'Callahan" , Ravi Shankar , 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 the x86-64 5.9-rc1 TLS is completely broken in 32 bit tracees when running under rr[0]. Booting the kernel with `nofsgsbase` fixes it and I bisected to https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.8&id=673903495c85137791d5820d690229efe09c8f7b. STR: 1. Build rr from source by a. git clone https://github.com/mozilla/rr b. mkdir rr/obj c. cd rr/obj d. cmake .. e. make -j16 2. Run the simple 32 bit tracee outside of rr with `./bin/simple_32`. It should print a message and exit cleanly. 3. Run it under rr with `./bin/rr ./bin/simple_32`. It should behave the same way, but with fsgsbase enabled it will segfault. The `simple_32` binary is a simple "hello world" type program but it does link to pthreads, so pre-main code attempts to access TLS variables. The interplay between 32 bit and 64 bit TLS is dark magic to me unfortunately so this is all the useful information I have. - Kyle [0] https://rr-project.org/