lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120615121031.GA28541@gmail.com>
Date:	Fri, 15 Jun 2012 14:10:31 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc:	Oleg Nesterov <oleg@...hat.com>, Hugh Dickins <hughd@...gle.com>,
	Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Anton Arapov <anton@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] uprobes: __copy_insn() should ensure a_ops->readpage
 != NULL


* Srikar Dronamraju <srikar@...ux.vnet.ibm.com> wrote:

> * Oleg Nesterov <oleg@...hat.com> [2012-06-07 19:00:18]:
> 
> > __copy_insn() blindly calls read_mapping_page(), this will crash
> > the kernel if ->readpage == NULL, add the necessary check. For
> > example, hugetlbfs_aops->readpage is NULL. Perhaps we should change
> > read_mapping_page() instead.
> > 
> > Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> > ---
> >  kernel/events/uprobes.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> > index 48d53af..9c53bc2 100644
> > --- a/kernel/events/uprobes.c
> > +++ b/kernel/events/uprobes.c
> > @@ -616,6 +616,8 @@ __copy_insn(struct address_space *mapping, struct vm_area_struct *vma, char *ins
> > 
> >  	if (!filp)
> >  		return -EINVAL;
> > +	if (!mapping->a_ops->readpage)
> > +		return -EIO;
> 
> Nit: Should there be a blank line before the if. Ingo had insisted on
> these coding style changes.

Well, within sensible limits: if()'s can certainly be in a block 
if they do related things (such as boundary checks, etc.), so 
the above isn't ugly IMO.

Nor are separating newlines strictly necessary - it's also a 
function of the complexity of the code in question - if it's 
complex code then we want all visual and cleanliness help that 
we can think of.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ