Received: by 10.192.165.148 with SMTP id m20csp2438256imm; Thu, 26 Apr 2018 10:59:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1NlxSxuxtX13E+l5G36xGNJE6BAUetMGZGQ9otR/SQl1+Ffo/BQghvbJf5zN3D4XloJ1v X-Received: by 10.98.62.194 with SMTP id y63mr9808436pfj.102.1524765584340; Thu, 26 Apr 2018 10:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524765584; cv=none; d=google.com; s=arc-20160816; b=0fQk4FUM13sV8tsQR0lpoIz7fjn+UKlhaL8iNeYNpOWWINMlfeUo2eFsdgrJbJlHWJ mrvwoU3+eo6W+6UtsL77f7LPdbuWXNRoZmX++shp0v947Ocd6Zx068Sq/lrMY+buWce2 380Z40Wst0byPRTpVq6+bppZBPnVkUOqnFQsQ6lN9lKwI4/1xoYDrZM3ywZGkAEAcCfG olM9u2nuAuKI0NWliYdJ5OTusQExqFjwyi1urbaOlRoYJep2hujgISdjER0qkCabfNdR hN2P9ZrMZmPXUxBQivkYlhvDXz892uSA7CHjoFjMekdG7ZCjJKZfEZtAhWvA0x0CFOsP XQ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:cc:references:to:subject :arc-authentication-results; bh=t7T29wN5vUSCybB1cDcWdgHAUihzRc2hxuRCeiX2bYc=; b=QhUKMBYeyy673PaeZQgTrchUWSyU+mi4Yrh0Wy2uSEpy0A0jZ/U2AiuYur4M20goSU ns7r9vozBLa3RYW4BAsAcVjSmdayGJPB0kDleNnBp4DZ8BcMqvfIMKFUxQL68ufKkJnJ GjgAgQ6rTs6+3xHpgaz/OBGKOw4yHPYKjgAFjFQh/2f/8W+BCOMSYVhh4sfwM/ZV5cW4 Fo6vOgPGWno7ms+39GvC54vjXTo9o9QNBQHArcrQQ8R2/8nC9lTUQeHXDHqZre54HWxF zT1upaJcXA9JEtNNvNPmhnWD9uxW4R91Psg/AkgFbn3+bYTB6QTAVO+RpittCtaE+uDc GSuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u17-v6si6612975plj.182.2018.04.26.10.59.29; Thu, 26 Apr 2018 10:59:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757010AbeDZR5d (ORCPT + 99 others); Thu, 26 Apr 2018 13:57:33 -0400 Received: from mga14.intel.com ([192.55.52.115]:35663 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756942AbeDZR5c (ORCPT ); Thu, 26 Apr 2018 13:57:32 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2018 10:57:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,331,1520924400"; d="scan'208";a="51082966" Received: from ray.jf.intel.com (HELO [10.7.201.17]) ([10.7.201.17]) by orsmga001.jf.intel.com with ESMTP; 26 Apr 2018 10:57:31 -0700 Subject: Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC To: Ram Pai References: <20180326172721.D5B2CBB4@viggo.jf.intel.com> <20180326172727.025EBF16@viggo.jf.intel.com> <20180407000943.GA15890@ram.oc3035372033.ibm.com> <6e3f8e1c-afed-64de-9815-8478e18532aa@intel.com> <20180407010919.GB15890@ram.oc3035372033.ibm.com> Cc: Dave Hansen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, shakeelb@google.com, stable@kernel.org, tglx@linutronix.de, mpe@ellerman.id.au, mingo@kernel.org, akpm@linux-foundation.org, shuah@kernel.org From: Dave Hansen Openpgp: preference=signencrypt Message-ID: Date: Thu, 26 Apr 2018 10:57:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180407010919.GB15890@ram.oc3035372033.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/06/2018 06:09 PM, Ram Pai wrote: > Well :). my point is add this code and delete the other > code that you add later in that function. I don't think I'm understanding what your suggestion was. I looked at the code and I honestly do not think I can remove any of it. For the plain (non-explicit pkey_mprotect()) case, there are exactly four paths through __arch_override_mprotect_pkey(), resulting in three different results. 1. New prot==PROT_EXEC, no pkey-exec support -> do not override 2. New prot!=PROT_EXEC, old VMA not PROT_EXEC-> do not override 3. New prot==PROT_EXEC, w/ pkey-exec support -> override to exec pkey 4. New prot!=PROT_EXEC, old VMA is PROT_EXEC -> override to default I don't see any redundancy there, or any code that we can eliminate or simplify. It was simpler before, but that's what where bug was.