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: <20170929132723.GA2318@linux.vnet.ibm.com>
Date:   Fri, 29 Sep 2017 06:27:23 -0700
From:   Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
        Ingo Molnar <mingo@...nel.org>,
        Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
        Anton Blanchard <anton@...ba.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/3] kernel/uprobes: Fix check for active uprobe

> >
> > --- a/kernel/events/uprobes.c
> > +++ b/kernel/events/uprobes.c
> > @@ -1751,6 +1751,19 @@ static struct uprobe *find_active_uprobe(unsigned long bp_vaddr, int *is_swbp)
> >  			uprobe = find_uprobe(inode, offset);
> >  		}
> >  
> > +		/* Ensure that the breakpoint was actually installed */
> > +		if (uprobe) {
> > +			/*
> > +			 * TODO: move copy_insn/etc into _register and remove
> > +			 * this hack.  After we hit the bp, _unregister +
> > +			 * _register can install the new and not-yet-analyzed
> > +			 * uprobe at the same address, restart.
> > +			 */
> > +			smp_rmb(); /* pairs with wmb() in prepare_uprobe() */
> > +			if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags)))
> > +				uprobe = NULL;
> > +		}
> 
> ACK ...
> 
> but the comment is no longer valid, it only mentions the race  unregister +
> register.
> 
> And note that "restart" is not true in that we are not going to simply restart,
> we will check is_trap_at_addr() and then either send SIGTRAP or restart.
> 
> This is correct because we do this check under mmap_sem so we can't race with
> install_breakpoint(), so is_trap_at_addr() == T can't be falsely true if
> UPROBE_COPY_INSN is not set.
> 

Right, Given that we are doing this in the mmap_sem, we should also be
removing the rmb/wmb pairs too.

Right Oleg?


> And btw, perhaps you should do this check right after find_uprobe() in the
> if (valid_vma) block.
> 
> Oleg.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ