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: <1308225141.13240.25.camel@twins>
Date:	Thu, 16 Jun 2011 13:52:21 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	Linux-mm <linux-mm@...ck.org>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	Hugh Dickins <hughd@...gle.com>,
	Christoph Hellwig <hch@...radead.org>,
	Jonathan Corbet <corbet@....net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Oleg Nesterov <oleg@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
	Roland McGrath <roland@...k.frob.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v4 3.0-rc2-tip 13/22] 13: uprobes: Handing int3 and
 singlestep exception.

On Tue, 2011-06-07 at 18:30 +0530, Srikar Dronamraju wrote:
> +void uprobe_notify_resume(struct pt_regs *regs)
> +{
> +       struct vm_area_struct *vma;
> +       struct uprobe_task *utask;
> +       struct mm_struct *mm;
> +       struct uprobe *u = NULL;
> +       unsigned long probept;
> +
> +       utask = current->utask;
> +       mm = current->mm;
> +       if (!utask || utask->state == UTASK_BP_HIT) {
> +               probept = get_uprobe_bkpt_addr(regs);
> +               down_read(&mm->mmap_sem);
> +               vma = find_vma(mm, probept);
> +               if (vma && valid_vma(vma))
> +                       u = find_uprobe(vma->vm_file->f_mapping->host,
> +                                       probept - vma->vm_start +
> +                                       (vma->vm_pgoff << PAGE_SHIFT));
> +               up_read(&mm->mmap_sem);
> +               if (!u)
> +                       goto cleanup_ret;
> +               if (!utask) {
> +                       utask = add_utask();
> +                       if (!utask)
> +                               goto cleanup_ret;

So if we fail to allocate task state,..

> +               }
> +               /* TODO Start queueing signals. */
> +               utask->active_uprobe = u;
> +               handler_chain(u, regs);
> +               utask->state = UTASK_SSTEP;
> +               if (!pre_ssout(u, regs, probept))
> +                       user_enable_single_step(current);
> +               else
> +                       goto cleanup_ret;
> +       } else if (utask->state == UTASK_SSTEP) {
> +               u = utask->active_uprobe;
> +               if (sstep_complete(u, regs)) {
> +                       put_uprobe(u);
> +                       utask->active_uprobe = NULL;
> +                       utask->state = UTASK_RUNNING;
> +                       user_disable_single_step(current);
> +                       xol_free_insn_slot(current);
> +
> +                       /* TODO Stop queueing signals. */
> +               }
> +       }
> +       return;
> +
> +cleanup_ret:
> +       if (u) {
> +               down_read(&mm->mmap_sem);
> +               if (!set_orig_insn(current, u, probept, true))

we try to undo the probe? That doesn't make any sense. I thought you
meant to return to userspace, let it re-take the trap and try again
until you do manage to allocate the user resource.

This behaviour makes probes totally unreliable under memory pressure. 

> +                       atomic_dec(&mm->uprobes_count);
> +               up_read(&mm->mmap_sem);
> +               put_uprobe(u);
> +       } else {
> +       /*TODO Return SIGTRAP signal */
> +       }
> +       if (utask) {
> +               utask->active_uprobe = NULL;
> +               utask->state = UTASK_RUNNING;
> +       }
> +       set_instruction_pointer(regs, probept);
> +} 

Also, there's a scary amount of TODO in there...
--
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