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, 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 3EE9AC10F29 for ; Tue, 10 Mar 2020 01:21:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DF19824654 for ; Tue, 10 Mar 2020 01:21:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=amacapital-net.20150623.gappssmtp.com header.i=@amacapital-net.20150623.gappssmtp.com header.b="g/iv7CpG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF19824654 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amacapital.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6DAD56B0093; Mon, 9 Mar 2020 21:21:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68D1B6B0096; Mon, 9 Mar 2020 21:21:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57B436B0098; Mon, 9 Mar 2020 21:21:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id 3D6156B0093 for ; Mon, 9 Mar 2020 21:21:06 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D313C180AD811 for ; Tue, 10 Mar 2020 01:21:05 +0000 (UTC) X-FDA: 76577698890.10.duck92_269e84640c508 X-HE-Tag: duck92_269e84640c508 X-Filterd-Recvd-Size: 6405 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Mar 2020 01:21:05 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id u10so677031pjy.0 for ; Mon, 09 Mar 2020 18:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:mime-version:subject:from:in-reply-to:cc :date:message-id:references:to; bh=mrUxxgNRy+5E4bEZVXAZNOiHka9AVVm3vCKbU9l6fA4=; b=g/iv7CpG8/DiYA4NA/mKsrAq67vf66xkLwrtr0OnzjXecbrlOk01TyaasjqzOJ/cy6 jkjE+yfOHqhIEodGUnCwDH2I67yhqD/opVoCRpcoVgu+agPVZLyJsNAcnfduPxpLnSIY FWAJ7VcA1vbAbasZjJHBV3szxpyaw/IjVhpRpaZZAzmlolgnoqTrx5PFTbyFCLsWL/hh e+FHgrtXApyn35w6Vpk1Rs7+FEhw6F26iHRoXV7X8YTvuouFOniMH3ge0MiWbLs+nVG7 4yVzA5v9uxjBTgJSNciJkl25N5hFus4/aSfLvMtEJHuvytjNWQXk1EtEGjXwJI8TsJ8b Lf5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:mime-version:subject :from:in-reply-to:cc:date:message-id:references:to; bh=mrUxxgNRy+5E4bEZVXAZNOiHka9AVVm3vCKbU9l6fA4=; b=kvqVvAvTVF57fii/lv5iHMuwDh5+nyiMbuLrL4N/T26izGgUnWDyl4eXo2XN8QfxwL 3MJ4jLdPr6niw23bjma08b2s0V9CiNYY/kctZufmJyUjO5Cug4hNXKp+FEZf5e9vZrIu ImAO9AC46qcmRYvQ007dLZtctFggnGuUXjjAY+JS+XkQVM9wjLJU/Ovs+QKiGxrj4up9 YRrLYxC/lkS7gA6CMGK6+ndKbGZYfjPxmIPOCQ/E7mXbjvvlO/EjEv1Aqcyx6/SamHAR Whcxg7W26Gpve/w5v3glUAvzXsumXfesv3SF8qK0RfaKYiW6hwFTkAxPUbJuElctCJ3D XmDg== X-Gm-Message-State: ANhLgQ18YrXL0GqVEQ0RTtgtKLgMrLdY4bMVLoIHLBlIZYY4p+tjBgy1 QpLaKCScOT98sNPqp4d26YQJoA== X-Google-Smtp-Source: ADFU+vsv4okX8I4n8qmcxoYDTnfJmLGi0d3Bk5liMiDsLRDCvsApNaCvlR6NOzyOKkYBsF2RXUSNlQ== X-Received: by 2002:a17:902:8a8f:: with SMTP id p15mr14339433plo.45.1583803264156; Mon, 09 Mar 2020 18:21:04 -0700 (PDT) Received: from ?IPv6:2600:1010:b047:6b2c:4878:83f4:4223:51c6? ([2600:1010:b047:6b2c:4878:83f4:4223:51c6]) by smtp.gmail.com with ESMTPSA id 17sm14250924pfu.166.2020.03.09.18.21.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Mar 2020 18:21:03 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Subject: Re: [RFC PATCH v9 01/27] Documentation/x86: Add CET description From: Andy Lutomirski In-Reply-To: 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 Date: Mon, 9 Mar 2020 18:21:01 -0700 Message-Id: References: To: "H.J. Lu" X-Mailer: iPhone Mail (17D50) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: I am baffled by this discussion. >> On Mar 9, 2020, at 5:09 PM, H.J. Lu wrote: >>=20 >> =EF=BB=BFOn Mon, Mar 9, 2020 at 4:59 PM Andy Lutomirski wrote: >=20 >>>> . >> 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 >=20 > 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 su= pport. Sure, creating threads behind libc=E2=80=99s back like this is perilo= us, but it can be done. >=20 >> fancy legacy bitmap to allow non-instrumented code to run with IBT on, >> although SHSTK doesn't have hardware support for a similar feature. >=20 > All these changes are called CET enabing. What does that mean? If program A loads library B, and library B very caref= ully loads CET-mismatched code, program A may be blissfully unaware. >=20 >> So, sure, the glibc-linked ELF ecosystem needs some degree of CET >> coordination, but it is absolutely not the case that a process MUST >> have all CET or no CET. Let's please support the complicated cases in >> the kernel and the ABI too. If glibc wants to make it annoying to do >> complicated things, so be it. People work behind glibc's back all the >> time. >=20 > CET is no different from NX in this regard. NX is in the page tables, and CET, mostly, is not. Also, we seriously flubb= ed READ_IMPLIES_EXEC and made it affect far more mappings than ever should h= ave been affected. If a legacy program (non-NX-aware) loads a newer library, and the library op= ens a device node and mmaps it PROT_READ, it gets RX. This is not a good de= sign. In fact, it=E2=80=99s actively problematic. Let us please not take Linux=E2=80=99s NX legacy support as an example of go= od design.=