Re: [PATCH 5/7] uprobes: introduce MMF_HAS_UPROBES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 08/09, Srikar Dronamraju wrote:
>
> * Oleg Nesterov <oleg@xxxxxxxxxx> [2012-08-08 19:37:47]:
>
> > Add the new MMF_HAS_UPROBES flag. It is set by install_breakpoint()
> > and it is copied by dup_mmap(), uprobe_pre_sstep_notifier() checks
> > it to avoid the slow path if the task was never probed. Perhaps it
> > makes sense to check it in valid_vma(is_register => false) as well.
> >
> > This needs the new dup_mmap()->uprobe_dup_mmap() hook. We can't use
> > uprobe_reset_state() or put MMF_HAS_UPROBES into MMF_INIT_MASK, we
> > need oldmm->mmap_sem to avoid the race with uprobe_register() or
> > mmap() from another thread.
> >
> > Currently we never clear this bit, it can be false-positive after
> > uprobe_unregister() or uprobe_munmap() or if dup_mmap() hits the
> > probed VM_DONTCOPY vma. But this is fine correctness-wise and has
> > no effect unless the task hits the non-uprobe breakpoint.
> >
>
> In which case, cant we just delete uprobe_munmap() altogether.

>From 0/7:

	The next series will teach uprobes to
	clear MMF_HAS_UPROBES, but perhaps we should simply remove
	uprobe_munmap() instead.

Yes, after this series uprobe_munmap() is nop, but see below.

> > @@ -1034,6 +1045,9 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon
> >  	if (!atomic_read(&vma->vm_mm->mm_users)) /* called by mmput() ? */
> >  		return;
> >
> > +	if (!test_bit(MMF_HAS_UPROBES, &vma->vm_mm->flags))
> > +		return;
> > +
>
> I am not sure whats the purpose of the above test
>
>
>
> >  	/* TODO: unmapping uprobe(s) will need more work */
>
> and I am unable to think what more we would want to do here.

The next series will add MMF_UPROBE_RECALC, this bits indicates that
MMF_HAS_UPROBES can be false-positive. uprobe_munmap() will roughly do

	if (find_node_in_range(start, end))
		set_bit(MMF_UPROBE_RECALC);

Once again, I am not sure we really need more complications, we will
discuss this later and decide. If we do not want them, we can kill
uprobe_munmap().

Just in case... uprobe_dup_mmap() is very simple but "sub-optimal".
We can improve this logic if we add uprobe_dup_vma() instead which
does

	if (test_bit(MMF_HAS_UPROBES))
		return;
	if (find_node_in_range(...))
		set_bit(MMF_HAS_UPROBES);

But again, it would be better to discuss this later.

Oleg.

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


[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Linux Kbuild]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]