Messages in this thread | | | From | Roland McGrath <> | Subject | Re: [PATCH] Kwatch: kernel watchpoints using CPU debug registers | Date | Fri, 23 Feb 2007 16:08:51 -0800 (PST) |
| |
> I think the best approach will be not to reset dr7 at all. Then there > won't be any need to worry about restoring it. Leaving a userspace > watchpoint enabled while running in the kernel ought not to matter; a > system call shouldn't touch any address in userspace more than once or > twice.
Hmm. That sounds reasonable. But I wonder why the old code clears %dr7. It's been that way for a long time (since 2.4 at least).
> My idea was to put 4 hwbkpt structures in thread_struct, so they would > always be available for use by ptrace. However it turned out not to be > feasible to replace the debugreg array with something more sophisticated, > because of conflicting declarations and problems with the ordering of > #includes. So instead I have been forced to replace debugreg[] with a > pointer to a structure which can be allocated as needed.
I think that's preferable anyway. Most tasks most of the time will never need that storage, so why not make thread_struct a little smaller? (There is also the potential for sharing, which I mentioned earlier.)
> This raises the possibility that a PTRACE syscall might fail because the > allocation fails. Hopefully that won't be an issue?
It's not a new issue, anyway, after utrace. The utrace-based ptrace can fail for PTRACE_ATTACH because of OOM too, which wasn't possible before. I think it's survivable.
Thanks, Roland - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |