Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1787907ybt; Sat, 20 Jun 2020 22:57:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygiqW5ceRvwiPTzMk0xq7vzG3GpkKarbzCtIk+CmHN1Ytf11/e6HT6TiDnt0I7xuw1exzz X-Received: by 2002:a17:906:4116:: with SMTP id j22mr10357655ejk.303.1592719035991; Sat, 20 Jun 2020 22:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592719035; cv=none; d=google.com; s=arc-20160816; b=cLPqNRGYCHtFFclx3hoLIlec4PziAyJ8Z5b7gAa/QoTPEeCLhR157nT7WN8UuQ+bC7 oUr2TjX/pLrqPQAKZNTGKkAXixlVzgi/9NDN52HoFgVOB52gkRkYy4R7cyQpZVaKTDca ru1tWW8MYgglwYfwPlgDg/AK54tX3j1qqzNfbhiLbxLV5D5xS85t+Xlhd/heXBf3R24p aBq/IZMIh86GFVtUeQeU7MpqqZXtutRf7QdbreH1vF6ekPLy4+t5i5DraYuOipUAxb/t 4IUKUkeGxeXNYlUqiyfwrGxoNL5qELa6u/SBLqlyZhh9Ztzdj1wPgym/duzmiyxxdIei RxKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fp1yhxbUQVqGMjbtesUXXr7LQLSJ1BhmPsusmU+xy/c=; b=l+yh5QX0e/Tat64NdzkszDd08ZqI5w37tJdC22llb18buxS6XyiuaWXFq/C2wFfg7j v4VuX/RCiZ0gYkccEKoTuv0qoe76zRlElY//n79CU99UYd+JsnG7t+KEMRqZ2ux3WEGq hTWDFrb2xMOJPPsT6Qu9uB2CYNe17ZfSZUXpwPJSF7Qe5H9EnN0ZsJZYQxdjxP6P1KL6 +PcH9LoJacQ3tEYoly2aaH8iS+KoYi19MAdyf45qwT5ho/rrf/tMSqyLEqR8bpP23yd4 KQR7v0LtcfmAC6zPXjQS2oJyVk9MleHKdrrzoOOYVtZWfia2m3yVUGlAKpprZCZKnEb8 KebQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=J5tY3LO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si6471251ejb.425.2020.06.20.22.56.52; Sat, 20 Jun 2020 22:57:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=J5tY3LO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729296AbgFUFzC (ORCPT + 99 others); Sun, 21 Jun 2020 01:55:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbgFUFzC (ORCPT ); Sun, 21 Jun 2020 01:55:02 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF24C061794 for ; Sat, 20 Jun 2020 22:55:01 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id k1so6046791pls.2 for ; Sat, 20 Jun 2020 22:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fp1yhxbUQVqGMjbtesUXXr7LQLSJ1BhmPsusmU+xy/c=; b=J5tY3LO6Q+K3Xld9I1MMGINGYQQtP3oFF0WuvhPIJGtZNAO3zi/n7/8kTC9Jj5ACPD o2+KUl223iSMQSw3AsD8j6AN5QWVHAeKwZreoRQYddt5mgfyyspWosNDG7k8tXlNiwST mTNCUnlbs3AXMdHCijBSGXVjYYzrKSMcJo0wI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fp1yhxbUQVqGMjbtesUXXr7LQLSJ1BhmPsusmU+xy/c=; b=XqkSOcfKCbMPabl+B/4n+t3G68cI58j1Gwl29C5uNmAz/4q/XHKV5tJ5FY3tAALRN4 l51JgRvhlefvUm3QKWZ1dIA3YVT5OhZbfFu5q4a/YFMVXQRHz2anRhqikmPJUpUsBs0b nuDVlAgF3GQXW44aFbBJq7se+O5LME3r/cLXClERYCrdLtPW+ZmCO14C/bhHVs+FSMBG zpEviMPVnUop2JYnH8kI3lXj1hXHYT0Hl9H3hHjgUsUeZu34nZwrHPQ7GiDIAkBD19G3 /6x0Gry8TGFodc8RU6QHy5NqmMVx6wcUvcr3ZonazpZJN9782hTyN2OCdV7+I19ia2GH HZew== X-Gm-Message-State: AOAM530slOZ5EcOfYz10PBlempJybxKk8EcHEb7nnmoUgvl6agGMqYc0 /XBP2JGImYbMfADviZ5b8jrr/w== X-Received: by 2002:a17:902:6b45:: with SMTP id g5mr5675575plt.3.1592718901055; Sat, 20 Jun 2020 22:55:01 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i5sm9762730pjd.23.2020.06.20.22.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jun 2020 22:55:00 -0700 (PDT) Date: Sat, 20 Jun 2020 22:54:58 -0700 From: Kees Cook To: David Howells , James Morris Cc: Sami Tolvanen , "Eric W. Biederman" , KP Singh , Casey Schaufler , Thomas Cedeno , Anders Roxell , linux-kernel@vger.kernel.org Subject: Re: [PATCH] security: fix the key_permission LSM hook function type Message-ID: <202006202254.D6B60F2@keescook> References: <20200615181232.119491-1-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200615181232.119491-1-samitolvanen@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 11:12:32AM -0700, Sami Tolvanen wrote: > Commit 8c0637e950d6 ("keys: Make the KEY_NEED_* perms an enum rather than > a mask") changed the type of the key_permission callback functions, but > didn't change the type of the hook, which trips indirect call checking with > Control-Flow Integrity (CFI). This change fixes the issue by changing the > hook type to match the functions. > > Fixes: 8c0637e950d6 ("keys: Make the KEY_NEED_* perms an enum rather than a mask") > Signed-off-by: Sami Tolvanen > --- > include/linux/lsm_hook_defs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h > index 6791813cd439..24f6683f1cfc 100644 > --- a/include/linux/lsm_hook_defs.h > +++ b/include/linux/lsm_hook_defs.h > @@ -360,7 +360,7 @@ LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred, > unsigned long flags) > LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key) > LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred, > - unsigned perm) > + enum key_need_perm need_perm) > LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer) > #endif /* CONFIG_KEYS */ > > > base-commit: b3a9e3b9622ae10064826dccb4f7a52bd88c7407 David, James? Can someone please take this? -- Kees Cook