From: Marc Zyngier <maz@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 1/2] exec: Restore EACCES of S_ISDIR execve()
Date: Fri, 14 Aug 2020 09:15:17 +0100 [thread overview]
Message-ID: <5ea68dd13fc8d5568b69f42fa384b8d3@kernel.org> (raw)
In-Reply-To: <20200813231723.2725102-2-keescook@chromium.org>
On 2020-08-14 00:17, 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 <maz@kernel.org>
> Link: https://lore.kernel.org/lkml/20200813151305.6191993b@why
> Fixes: 633fb6ac3980 ("exec: move S_ISREG() check earlier")
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> 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: Marc Zyngier <maz@kernel.org>
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2020-08-14 8:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 23:17 [PATCH 0/2] Fix S_ISDIR execve() errno Kees Cook
2020-08-13 23:17 ` [PATCH 1/2] exec: Restore EACCES of S_ISDIR execve() Kees Cook
2020-08-14 7:11 ` Greg Kroah-Hartman
2020-08-14 8:13 ` Greg Kroah-Hartman
2020-08-14 8:15 ` Marc Zyngier [this message]
2020-08-13 23:17 ` [PATCH 2/2] selftests/exec: Add file type errno tests Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ea68dd13fc8d5568b69f42fa384b8d3@kernel.org \
--to=maz@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.