mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Roland McGrath <roland@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, hch <hch@infradead.org>,
	Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: [PATCH 0/2] utrace
Date: Mon, 06 Oct 2008 22:47:02 +0200	[thread overview]
Message-ID: <1223326023.12409.60.camel@lappy.programming.kicks-ass.net> (raw)
In-Reply-To: <20080826220102.89635154233@magilla.localdomain>

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


      parent reply	other threads:[~2008-10-06 20:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26 22:01 Roland McGrath
2008-08-26 22:01 ` [PATCH 1/2] utrace core Roland McGrath
2008-08-26 22:55   ` Alexey Dobriyan
2008-08-27 21:32     ` Alexey Dobriyan
2008-08-27 21:46       ` Alexey Dobriyan
2008-08-27 22:00         ` Alexey Dobriyan
2008-08-30 13:45     ` Christoph Hellwig
2008-09-03 12:11     ` Roland McGrath
2008-09-03 17:01       ` Alexey Dobriyan
2008-08-27 20:04   ` Alexey Dobriyan
2008-09-03 12:11     ` Roland McGrath
2008-09-03 18:44       ` Christoph Hellwig
2008-08-30 15:05   ` Alexey Dobriyan
2008-09-03 12:58   ` Petr Tesarik
2008-09-03 18:08     ` Roland McGrath
2008-09-03 18:46       ` Christoph Hellwig
2008-09-04  9:03         ` Petr Tesarik
2008-08-26 22:02 ` [PATCH 2/2] utrace: ptrace cooperation Roland McGrath
2008-08-30 13:38   ` Christoph Hellwig
2008-09-03 12:10     ` Roland McGrath
2008-09-03 18:41       ` Christoph Hellwig
2008-08-26 22:34 ` [PATCH 0/2] utrace Alexey Dobriyan
2008-08-26 22:39   ` Christoph Hellwig
2008-08-27  0:17   ` Frank Ch. Eigler
2008-08-27 13:54     ` Christoph Hellwig
2008-08-27 16:40       ` Ananth N Mavinakayanahalli
2008-08-30 13:40         ` Christoph Hellwig
2008-09-03 12:09           ` Roland McGrath
2008-09-03 18:37             ` Christoph Hellwig
2008-08-27 15:34     ` Alexey Dobriyan
2008-08-29 19:04       ` Frank Ch. Eigler
2008-08-30 13:43       ` Christoph Hellwig
2008-08-27 18:50   ` Alexey Dobriyan
2008-08-27  2:03 ` Peter Zijlstra
2008-10-06 20:47 ` Peter Zijlstra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1223326023.12409.60.camel@lappy.programming.kicks-ass.net \
    --to=a.p.zijlstra@chello.nl \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome