Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1359295rwd; Tue, 16 May 2023 16:16:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4UO18jKb2foHKiNxOMyf/83vdwdpmocz/ccbgoEKD51HHK/8j0TCqH8exDDB1cR8d+JQYX X-Received: by 2002:a17:90b:1809:b0:250:7d1f:938b with SMTP id lw9-20020a17090b180900b002507d1f938bmr32799561pjb.23.1684278985453; Tue, 16 May 2023 16:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684278985; cv=none; d=google.com; s=arc-20160816; b=ZZh5lT975QSc4+RN/mKwQcIT7d8wSYurmdz+uj8jO8xA5o9YPxoQC2dZnrqb+ZFmO0 OCJEatPVewC/yNVB/mwpLGJkYBbkDMVuzQeyIPag9r7BPa0CJ1kePSbrH5h1XXzed6/K N9Fzws27OdIczp9sMmN5lavlM6txMDmlXregcOlVKjP2AABLdrnNwW87VU/zrX2rP09S lJ+1RBFXFnXZYV376XVgL6x4Mt1dm/J0itbfe43dXd8Y8VvXL/X/T6jH+1MvLNfAEtHW bFI2h3oH3i1PQUx+OKUO1u77Gx9cfB9ZFtufsJCkasNjW8wLBEY4pzqpVhaegg3n1lza VApg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=GIf9EegABc5fPN6I1KAt3LxSfjU/Ksh1Hs5lgsqiyDw=; b=HqaKBgNr98sbH66tNVMNithPYHfH40zYtXZnaHf1HTBpRmNI5AmsVcZhwLiIWYDz7W QuHW2pH6gNa5SIyyp1ZMY3jxnXmV55SGoGW/c9YGGVJu0H1V31yxsKIqGm+6kal4LHVL N1vC421Fl87Nlfjyw5HWCoXNjPO/8HlIRN0WX0TbsK4RUSSQ3ExoT/mFVH0uA2f6wp8r eB/jJ16lOC1UqcttnSWXAJW6z951qGP7OjSrlvXxAZuKJgxx2pl6vbDnQXUyln5dZKsi GsGH3WnOzoaQ0V/6X8fged3Be4OginZMj6efWWTSTG/cfgr8a3wwoJmQ50tCeXko3gDx LrEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NdglkvaX; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a17090aad8f00b002532933832csi289483pjq.78.2023.05.16.16.16.11; Tue, 16 May 2023 16:16:25 -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=@intel.com header.s=Intel header.b=NdglkvaX; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbjEPXOu (ORCPT + 99 others); Tue, 16 May 2023 19:14:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjEPXOt (ORCPT ); Tue, 16 May 2023 19:14:49 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 658DB49DB; Tue, 16 May 2023 16:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684278888; x=1715814888; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=JCw5VDXXb5Zk0n4g9fN35Q/ecw5PPviAKCFFmpEcKTs=; b=NdglkvaXRyGZP2tYkouuhQj2/jqf7Owaeu8tyl2OILy04B76yppM4ggb DIemWnRsqt5jDmPpmVfeGorAXCXu/aKBklklRdOobagAdIuAjI+9OaqSs MTxMtUNpnwu2b6tLH7vVNsIpJgLl1xVA3NuKAKGB7soLTxQl/Tn0v6a4H L8rrp8mJsCXL1NY6M7oKvZshfMZ9lxKgjfq0g6N2Fy8ETK5Ag6HmZcHF0 qOjthJmVrAGYc+3VbJglabyXyXOMlTD5Q++k5KHra2esp0JkxyiDXbHgE qQt7yX6xZckkmzo4e7gSzuBYGLYe1nCYMO5i6YgmpfFoKws6P5gmR4G3j g==; X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="415019732" X-IronPort-AV: E=Sophos;i="5.99,280,1677571200"; d="scan'208";a="415019732" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 16:14:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="679039950" X-IronPort-AV: E=Sophos;i="5.99,280,1677571200"; d="scan'208";a="679039950" Received: from mtpanu-mobl1.amr.corp.intel.com (HELO [10.212.203.6]) ([10.212.203.6]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 16:14:47 -0700 Message-ID: <6cb7df56-0479-30be-5389-b4b819572deb@intel.com> Date: Tue, 16 May 2023 16:14:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 1/6] PKEY: Introduce PKEY_ENFORCE_API flag Content-Language: en-US To: jeffxu@chromium.org, luto@kernel.org, jorgelo@chromium.org, keescook@chromium.org, groeck@chromium.org, jannh@google.com, sroettger@google.com Cc: akpm@linux-foundation.org, jeffxu@google.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org References: <20230515130553.2311248-1-jeffxu@chromium.org> <20230515130553.2311248-2-jeffxu@chromium.org> From: Dave Hansen In-Reply-To: <20230515130553.2311248-2-jeffxu@chromium.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 On 5/15/23 06:05, jeffxu@chromium.org wrote: > --- a/arch/x86/mm/pkeys.c > +++ b/arch/x86/mm/pkeys.c > @@ -20,7 +20,7 @@ int __execute_only_pkey(struct mm_struct *mm) > /* Do we need to assign a pkey for mm's execute-only maps? */ > if (execute_only_pkey == -1) { > /* Go allocate one to use, which might fail */ > - execute_only_pkey = mm_pkey_alloc(mm); > + execute_only_pkey = mm_pkey_alloc(mm, 0); > if (execute_only_pkey < 0) > return -1; > need_to_set_mm_pkey = true; In your threat model, what mechanism prevents the attacker from modifying executable mappings? I was trying to figure out if the implicit execute-only pkey should have the PKEY_ENFORCE_API bit set. I think that in particular would probably cause some kind of ABI breakage, but it still reminded me that I have an incomplete picture of the threat model.