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=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 2B9F4C433DF for ; Fri, 14 Aug 2020 08:13:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F24802068E for ; Fri, 14 Aug 2020 08:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597392794; bh=MmxQNl8+vLlHzOR3qnK3CTNQlzCrPiowIyHnwsh4Te4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=A3tOiRFTxEj/B81aYJU/+UMe8aAk8xaKQW+2Dw1jJ3Fx7lzy4Z2F+kdAhpjraSSaA gq0XPjLnQx5ldOaBY7a2hEoCnHPG0thA0gSw91XHWN17coymKG6qU0U7MmNY+Guu+Y VqzryuKgwSNgvxtP92fdO1evyGebwNqxjCWSD/IE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbgHNINM (ORCPT ); Fri, 14 Aug 2020 04:13:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:53684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgHNINL (ORCPT ); Fri, 14 Aug 2020 04:13:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE37D2068E; Fri, 14 Aug 2020 08:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597392791; bh=MmxQNl8+vLlHzOR3qnK3CTNQlzCrPiowIyHnwsh4Te4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G5Y3OMEcOwAECD8bL+8gJnC3dK/tHABFsBSBMEqFqTIZojB9lu+YyiUqm8Y3e+5pd UsnqvIreB/iqsdauEBOksdFNJakgQD79jLMntIV37vF/EzK1FhIpbWPwvWPPTVn44k GbL2DilF46d7kuC06NkbyFEzpm8GgK+7cUENAJns= Date: Fri, 14 Aug 2020 10:13:19 +0200 From: Greg Kroah-Hartman To: Kees Cook Cc: Andrew Morton , Marc Zyngier , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 1/2] exec: Restore EACCES of S_ISDIR execve() Message-ID: <20200814081319.GA4075588@kroah.com> References: <20200813231723.2725102-1-keescook@chromium.org> <20200813231723.2725102-2-keescook@chromium.org> <20200814071102.GA4062560@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200814071102.GA4062560@kroah.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 14, 2020 at 09:11:02AM +0200, Greg Kroah-Hartman wrote: > On Thu, Aug 13, 2020 at 04:17:22PM -0700, Kees Cook wrote: > > The return code for attempting to execute a directory has always been > > EACCES. Adjust the S_ISDIR exec test to reflect the old errno instead > > of the general EISDIR for other kinds of "open" attempts on directories. > > > > Reported-by: Marc Zyngier > > Link: https://lore.kernel.org/lkml/20200813151305.6191993b@why > > Fixes: 633fb6ac3980 ("exec: move S_ISREG() check earlier") > > Signed-off-by: Kees Cook > > --- > > fs/namei.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/fs/namei.c b/fs/namei.c > > index 2112e578dccc..e99e2a9da0f7 100644 > > --- a/fs/namei.c > > +++ b/fs/namei.c > > @@ -2849,8 +2849,10 @@ static int may_open(const struct path *path, int acc_mode, int flag) > > case S_IFLNK: > > return -ELOOP; > > case S_IFDIR: > > - if (acc_mode & (MAY_WRITE | MAY_EXEC)) > > + if (acc_mode & MAY_WRITE) > > return -EISDIR; > > + if (acc_mode & MAY_EXEC) > > + return -EACCES; > > break; > > case S_IFBLK: > > case S_IFCHR: > > > Reviewed-by: Greg Kroah-Hartman And to round out the "let's use a different email address for each response, to drive accounting tools crazy!" effort, you can also add: Tested-by: Greg Kroah-Hartman thanks, greg "I don't have enough different email addresses" k-h