Messages in this thread |  | | Date | Mon, 28 Aug 2000 18:26:40 +0200 (CEST) | From | Martin MaD Douda <> | Subject | Re: SCO: "thread creation is about a thousand times faster than on |
| |
On 27 Aug 2000, Linus Torvalds wrote:
> > Btw, here's a simple thread-group patch. It doesn't actually _do_ > anything with the thread group part, but this is the kind of frame-work > I've envisioned. Completely untested, of course, but with these kinds > of security issues taken into account. > > Comments? At least it's small and simple.. > > Linus
And what will be done, when thread-group leader (tgig==pid) will exec() ? If I read your core correctly, it will be de_threaded by seting tgid=pid, but it was before! So the process will _not_ be removed from thread group. and it will remain in thread group _after_ exec. Am I mistaken?
Martin
> > ---- > diff -u --recursive --new-file penguin/linux/fs/exec.c linux/fs/exec.c > --- penguin/linux/fs/exec.c Mon Aug 14 10:19:55 2000 > +++ linux/fs/exec.c Sun Aug 27 17:29:52 2000 > @@ -496,6 +496,25 @@ > write_unlock(&files->file_lock); > } > > +/* > + * An execve() will automatically "de-thread" the process. > + * Note: we don't have to hold the tasklist_lock to test > + * whether we migth need to do this. If we're not part of > + * a thread group, there is no way we can become one > + * dynamically. And if we are, we only need to protect the > + * unlink - even if we race with the last other thread exit, > + * at worst the list_del_init() might end up being a no-op. > + */ > +static inline void de_thread(struct task_struct *tsk) > +{ > + if (!list_empty(&tsk->thread_group)) { > + write_lock_irq(&tasklist_lock); > + list_del_init(&tsk->thread_group); > + write_unlock_irq(&tasklist_lock); > + } > + tsk->tgid = tsk->pid; > +} > + > int flush_old_exec(struct linux_binprm * bprm) > { > char * name; > @@ -533,6 +552,8 @@ > current->comm[i] = '\0'; > > flush_thread(); > + > + de_thread(current); > > if (bprm->e_uid != current->euid || bprm->e_gid != current->egid ||
-------------------------------------------------------------------------------- Martin "MaD" Douda WEB: http://martin.douda.net/ PHONE:+420603752779 ICQ# 86467013 EMAIL: <martin@douda.net>, <mad@gate.mobil.cz> (160 characters only) PGP:ID=0x6FE43023 Fingerprint:E495 11DA EF6E 0DD6 965A 54F3 888E CC9E 6FE4 3023 -------------------------------------------------------------------------------- The only thing good about "standards" in computer science is that there are so many to choose from.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |