All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mukesh Ojha <mojha@codeaurora.org>
To: Nikitas Angelinas <nikitas.angelinas@gmail.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	syzbot+0d1fcd7268b21baced4a@syzkaller.appspotmail.com
Subject: Re: [PATCH] fs/binfmt_elf.c: fix GPF when dereferencing invalid interpreter
Date: Sat, 30 Mar 2019 21:46:53 +0530	[thread overview]
Message-ID: <47235084-9333-1096-e411-8d25ec120f30@codeaurora.org> (raw)
In-Reply-To: <20190330140032.GA1527@vostro>


On 3/30/2019 7:30 PM, Nikitas Angelinas wrote:
> Syzkaller found an issue where an invalid interpreter pointer is
> dereferenced in load_elf_binary()->allow_write_access()


please mention here on failure path inside  allow_write_access

as there are two path it gets called.


> . Fix this by
> jumping to a different label in the cleanup path.
>
> This patch applies against the latest linux-next tree. I have not tested
> that the patch addresses the issue, but it should, imho.


This should not be written in commit text body.
please fix.

>
> Signed-off-by: Nikitas Angelinas <nikitas.angelinas@gmail.com>
> Reported-by: syzbot+0d1fcd7268b21baced4a@syzkaller.appspotmail.com
> Fixes: 44e63c4a0263 ("fs/binfmt_elf.c: free PT_INTERP filename ASAP")
> ---



Patch looks valid to me as interpreter may be NULL and it later get 
tried to dereferencing inside allow_write_access

under label out_free_dentry.


Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>


Cheers,
-Mukesh

>   fs/binfmt_elf.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 51bc894..09e76b2 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -777,7 +777,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
>   			kfree(elf_interpreter);
>   			retval = PTR_ERR(interpreter);
>   			if (IS_ERR(interpreter))
> -				goto out_free_dentry;
> +				goto out_free_ph;
>   
>   			/*
>   			 * If the binary is not readable then enforce

      reply	other threads:[~2019-03-30 16:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30 14:00 [PATCH] fs/binfmt_elf.c: fix GPF when dereferencing invalid interpreter Nikitas Angelinas
2019-03-30 16:16 ` Mukesh Ojha [this message]

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=47235084-9333-1096-e411-8d25ec120f30@codeaurora.org \
    --to=mojha@codeaurora.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikitas.angelinas@gmail.com \
    --cc=syzbot+0d1fcd7268b21baced4a@syzkaller.appspotmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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.