From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BBFEC10F29 for ; Tue, 10 Mar 2020 02:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 530282146E for ; Tue, 10 Mar 2020 02:14:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L6Xq9iZG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbgCJCOM (ORCPT ); Mon, 9 Mar 2020 22:14:12 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:40452 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgCJCOL (ORCPT ); Mon, 9 Mar 2020 22:14:11 -0400 Received: by mail-ot1-f66.google.com with SMTP id x19so11712819otp.7; Mon, 09 Mar 2020 19:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gAewQcsa0gHih3wXpHAV80ssMemQtrtXXF853KTte9o=; b=L6Xq9iZGLEa1l14/JrlBDJBkv6HSKObpOzYqkDvz6JQ3GsPAHMI1pWejPHQchkBx/J 7DYTfbBRiVRSC0rvWKTxzNI97bTlim0XdN1HVXIso9GWDDH9ZIEbUsirmgrK6cjDzCTV Ge94uFgJxo8bbnbP094yO7yKys8bFQDoQAIyZXhbAPUTDKRJU0Y23zTDUcqdQo0643N+ scYHFsyP+aMiDWTUKAw8HAzoul6KYwMEnWVYDdb1HCxu9FCzTzNwuC4hfZJEYYtjNDbh 71T4jtmAKGVBmywAehooLNjMEYzMwT8EoZhKl4EpuxgMTAxYCKfHbzE3aG4uKl6iobk8 PSag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gAewQcsa0gHih3wXpHAV80ssMemQtrtXXF853KTte9o=; b=NJpAJIl4/3LAigf+NTv5OlBER404onshMb2msx/G6/soCyHUxeEd7FNNBd+0scmaHu O8kgIH5FXcjOR/g5khOv20F7hLQfNfNOjIqP28IOjEgCLLU1AHC8IsWzeAzNb/84rvvN k6fIexutaQ1BXY04iEw3BeK4+cg1lDk/Sy7UtHUlP4vcqZzcQxqbSSuCMnlokB+INtuk 4ACU4bdZT/DUSUqhAD4MXYhh6oYJAhlCyT+BPAZeh5D2wIHGt5yi90+clP11EI1Cp717 3rPqEtA0KRIDyBpiRewYby1WFYtMC8RYh4nefnr0nV4rj7b+npganhb2nPOiLrWZbZt5 MMDw== X-Gm-Message-State: ANhLgQ1fGTRcik6H2uc0bTnIQWzxDKbzH37aq/glYKdDroWw0ihclkzx bAzA7yBbTwr/IMUlZe19/wNNVPIG+4O3KAgkSbc= X-Google-Smtp-Source: ADFU+vtaVVdLu4F7XALa/kOBsPcMpoxoqzHShyPAI8Uyv+DJuJS2VG1IYhdWG4KhM/G0WcnD+WqCE+VveBubEMUEXwI= X-Received: by 2002:a9d:19ef:: with SMTP id k102mr12179526otk.220.1583806450481; Mon, 09 Mar 2020 19:14:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Mon, 9 Mar 2020 19:13:34 -0700 Message-ID: Subject: Re: [RFC PATCH v9 01/27] Documentation/x86: Add CET description To: Andy Lutomirski Cc: Dave Hansen , Yu-cheng Yu , "the arch/x86 maintainers" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , x86-patch-review@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 9, 2020 at 6:21 PM Andy Lutomirski wrote: > > I am baffled by this discussion. > > >> On Mar 9, 2020, at 5:09 PM, H.J. Lu wrote: > >> > >> =EF=BB=BFOn Mon, Mar 9, 2020 at 4:59 PM Andy Lutomirski wrote: > > > >>>> . > >> This could presumably have been fixed by having libpcre or sljit > >> disable IBT before calling into JIT code or by running the JIT code in > >> another thread. In the other direction, a non-CET libpcre build could > >> build IBT-capable JITted code and enable JIT (by syscall if we allow > >> that or by creating a thread?) when calling it. And IBT has this > > > > This is not how thread in user space works. > > void create_cet_thread(void (*func)(), unsigned int cet_flags); > > I could implement this using clone() if the kernel provides the requisite= support. Sure, creating threads behind libc=E2=80=99s back like this is pe= rilous, but it can be done. Sure, this can live outside of libc with kernel support. > > > >> fancy legacy bitmap to allow non-instrumented code to run with IBT on, > >> although SHSTK doesn't have hardware support for a similar feature. > > > > All these changes are called CET enabing. > > What does that mean? If program A loads library B, and library B very ca= refully loads CET-mismatched code, program A may be blissfully unaware. Any source changes to make codes CET compatible is to enable CET. Shadow stack can't be turned on or off arbitrarily. ld.so checks it and makes sure that everything is consistent. But this is entirely done in user space. In the first phase, we want to make CET simple, not too complicated. H.J.