Messages in this thread | | | Subject | Re: [PATCH 0/2] utrace | From | Peter Zijlstra <> | Date | Mon, 06 Oct 2008 22:47:02 +0200 |
| |
Hi Roland,
I've been looking over the utrace code:
git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-utrace.git
git diff d3a47e82b6bc3724dd60f3ee4e84fe4479104382..utrace/master
and while I'm nowhere near done, I'd like to provide some feedback and pose some questions.
- what's up with these weak declarations?
- struct utrace_attached_engine is a tad strange as we don't have a regular struct utrace_engine.
- does it make sense to create this struct utrace_engine and replace the struct utrace_engine_ops and the void *data members of struct utrace_attached_engine with a pointer to it, and obtain the data by using container_of() on the engine itself? That is, let the user embed struct utrace_engine in a larger structure.
- I encountered a lot of unannotated memory barriers. Please add a comment to each and every one describing the race and a pointer to its pair. There is no such thing as a trivial memory barrier.
- it has these decidedly un-kernel-ish public/private comments
- Why does it have two lists for attaching tasks? The description/comments explain how it works but not why we do it that way.
- utrace_attach_task() was very hard to read, the code flow is unconventional at best.
- utrace_stop() can seemingly return true even though it didn't get SIGKILL - contrary to its comments.
- get_utrace_lock() made me look at ->engine_ops serialisation - I couldn't convince myself its race free.
- I saw a lot of if (unlikely(a) || unlikely(b)) style thing, please write as if (unlikely(a || b)).
- utrace_release_task() seems to be missing rcu_read_lock()/rcu_read_unlock() to ensure the utrace pointer stays valid.
- utrace_control() seems to access ->exit_state in a racy manner.
- some comments say 'race' but fail to provide specifics.
- as was suggested by Christoph and Alexey, removing struct utrace *task_struct::utrace in favour of embedding it right into task_struct itself would remove quite a bit of complexity. I would consider doing this, esp as you could remove the ptrace specifics from task_struct.
hth
| |