Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 11 Mar 2012 14:03:10 +0000
From: Alan Cox <>
To: Linus Torvalds <>
Cc: Djalal Harouni <>,,,
        Andrew Morton
        Al Viro <>,
 Dobriyan <>,
        "Eric W. Biederman"
        Vasiliy Kulikov <>,
        Kees Cook
        Solar Designer <>,
        WANG Cong
        James Morris <>,
 Nesterov <>,,,
        Greg KH <>, Ingo
 Molnar <>,
        Stephen Wilson <>,
        "Jason A.
 Donenfeld" <>
Subject: Re: [PATCH 1/9] exec: add a global execve counter

> I wonder if the number part of exec_id would even have to be 64-bit. I
> think I can do about 10000 execves per second if I make the program a
> small static one - and that's on a fast CPU. And it's a per-thread
> counter, so you can't scale it with lots of CPU's. So it would take
> something like four days to wrap. Hmm..

I don't think an exec id trick works that well here. It needs to bind to
the actual *object* being used and refcount it in the cases that matter,
then have a proper way of ensuring we clean up references such as a list
of objects to zap hooked to each task struct

So something like

	struct foo_node {
		struct list_node node;
		struct proc_object *ref;
	ref = NULL;
	if (foo->ptr != NULL
		ref = kref_get(foo->ptr);

And in the task exit paths walk the node list doing a kref_put/NULL

Add a suitable lock and it ought to be able to generically do that for
anything you need to clobber.

You've still got a sort of race however, just as the proposed execid base
code.  You can pass the fd and access the proc function *as* the exec
occurs. Assuming your ref counting is valid and you use new objects after
the exec that ought to just mean you get the data for the old mm struct,
which seems fine to me. It's logically equivalent to having asked a
microsecond before the exec rather than during it.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.