Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503661

Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv
Date 2016-10-19 16:30 +0200
Message-ID <su02u-2rf-49@gated-at.bofh.it> (permalink)
References <su02u-2rf-51@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Oct 19, 2016 at 09:59:40PM +0800, Leon Yu wrote:
> Reading auxv of any kernel thread results in NULL pointer dereferencing in
> auxv_read() where mm can be NULL or even error code. Fix that by testing mm
> with IS_ERR_OR_NULL() helper. This is also the original behavior changed by
> recent commit c5317167854e ("proc: switch auxv to use of __mem_open()").

What the...  How can it be ERR_PTR(...) after it has passed __mem_open()?
I agree that we ought to check for NULL mm (the only question is whether it's
best done by failing open() or by treating the file as empty), but this
IS_ERR_OR_NULL() is pure cargo-cult, AFAICS.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Al Viro <viro@ZenIV.linux.org.uk> - 2016-10-19 16:30 +0200
  Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Leon Yu <chianglungyu@gmail.com> - 2016-10-19 17:00 +0200
  Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Michal Hocko <mhocko@kernel.org> - 2016-10-19 17:00 +0200

csiph-web