Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2800731rwa; Mon, 22 Aug 2022 14:11:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR55NZzg0m/8oF02SK7uXWd1KypfMB+WQ2yapkUvdhtb8+qSKEw6kAncE0B4lHCAmem3QTew X-Received: by 2002:a05:6402:4148:b0:440:cb9f:d10f with SMTP id x8-20020a056402414800b00440cb9fd10fmr835735eda.77.1661202699535; Mon, 22 Aug 2022 14:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661202699; cv=none; d=google.com; s=arc-20160816; b=DdO2xV9pT7iBIU0af/YyOxwD8KWQQVFAyYxx1jY8VlLBwWoLFgxHY7ruBRfK4wcS4e HMKgyhKBL6x3BrcSCU4cFuUSXDnu70a/4CjYnQN3028Kzur0dELDYH65bDxCWYhrFGDz taRUpaq4u+yodm2Y0BkeHONsVYh1HvORVp2EW54NE/MVWcVAoT4gp4EATM3wtD690x6R jpLbqVwfuJMegShxNHv7UaCbzz1U2p+omoO2ImL6spbsVwAlg3SsFDkrotR8bLv3/epV 222bZb3UhsFADArORTpanlRp1+lUO+r3oKGMBSc02z6VLlIz5Pc2ZDRnkYI1MLsxePhp +7Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=3BHC1pk8KI31+SswPTa3tsLnHZ/LE74BAq19PUgh0YI=; b=lryl9LLURLlB7UZXi1On8zRrBtEEB9UZ8mfMLriFJfqAWZJbqgQ2Kl5rCLuKQ9BJwW 6bqSlIV5LIgWg87+jSe0jpHlc00Uucr3LHPDTLXqN3kO7wZCgRsbxtNoeobWMMVf+H48 7A9RG+Q2I+3Lf+R4Ew89Rm4V7XWp5QTtTqwYPvwlKsAk6y0gVmOKmwA9GnCMmkMdw6V+ jFYKijf27g7vsSbQTbXpCd/w58XWB8mHBo9RPYaFfjnAjnpyTaRGRDe1R9OGXARXVYqJ zfoSDke2Osblj970MkxyQfLnlbyQ95Zea40cJTagPvD+Ag17VfLL6vt7Xf2s+vwJxi9Z MdXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="i2/JSIlr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a50f689000000b00440072d0ae3si129382edn.196.2022.08.22.14.11.14; Mon, 22 Aug 2022 14:11:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="i2/JSIlr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237748AbiHVUkc (ORCPT + 99 others); Mon, 22 Aug 2022 16:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237724AbiHVUka (ORCPT ); Mon, 22 Aug 2022 16:40:30 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 570D04457C for ; Mon, 22 Aug 2022 13:40:30 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so12558066pjf.2 for ; Mon, 22 Aug 2022 13:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:content-disposition:mime-version :message-id:subject:cc:to:from:date:from:to:cc; bh=3BHC1pk8KI31+SswPTa3tsLnHZ/LE74BAq19PUgh0YI=; b=i2/JSIlrWKRYJLDkwbLCysQtjBIYjpL6uCXlxOE1xSNpSvYfNgJWucykEdEqNiE18O +Qk8LcIHUgSYmVcDixCm6h/JUEiO4Bs/S46kzUv9JzZZEdMVxCEiYFhDPiD1gbWFP/4c TuXg7xrpGXgpmDMU7EuPq7Qtjbw4BkgDLLTEY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-disposition:mime-version :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=3BHC1pk8KI31+SswPTa3tsLnHZ/LE74BAq19PUgh0YI=; b=hdCG8oTm0qZuHXrLE9lhfiDXJm1WPCX1Ufyr5s7r8z5LpoGnM5+Hkc7CsJcTxR4Tas 1ZPkFJPX7vKGm1zYPPyHJ/tVSR5zB6W5BTBuybMCXu44E4dVL8aYAtrUf1c0dPv8XJ2i AKRWC+ufOxKaE2zk40GU0meD5b9SPCo1EL8sMWr+/ZJUK8zgldiWoLW4IoU8fDCvoCHW l48FFKZW//r2DCmu+Di64yilCLN4trRBEU1s3dhiwoAxXLNmFIp2j629Ms8DakZ4Afbp 0RempSt4Q6daoRqw39oPm9q+OZVFwMqVMJZDK/QhqPnrIE7Op2D6L/b8fmvsdL0hi8zr T+ZA== X-Gm-Message-State: ACgBeo3Ho80BIuRTsEjcYp2GL0SbQftoUv4RnNPhnP6scUZ3MbcGffB7 CRgvvuVgGb0nL93YPihQUSxLGg== X-Received: by 2002:a17:90b:2c06:b0:1fa:e636:105a with SMTP id rv6-20020a17090b2c0600b001fae636105amr110649pjb.169.1661200829897; Mon, 22 Aug 2022 13:40:29 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h3-20020a170902f7c300b0015e8d4eb1f7sm8772425plw.65.2022.08.22.13.40.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 13:40:29 -0700 (PDT) Date: Mon, 22 Aug 2022 13:40:28 -0700 From: Kees Cook To: Dave Hansen Cc: Stephen =?iso-8859-1?Q?R=F6ttger?= , x86@kernel.org, linux-kernel@vger.kernel.org Subject: PKU usage improvements for threads Message-ID: <202208221331.71C50A6F@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! I was hoping to start a conversation about PKU usage for threads in two places, which Stephen R?ttger brought to my attention, with the hope of being able to use these in Chrome: 1) It appears to be a bug that a thread without the correct PK can make VMAs covered by a separate PK, out from under other threads. (e.g. mmap a new mapping to wipe out the defined PK for it.) It seems that PK checks should be made when modifying VMAs. 2) It would be very helpful to have a mechanism for the signal stack to be PK aware, in the sense that the kernel would switch to a predefined PK. i.e. having a new interface to sigaltstack() which includes a PK. Are either of these something the PKU authors have considered? (Or are there some details we're missing in this area?) Thanks! -Kees -- Kees Cook