Re: [RFC][PATCH] Add prctl to set sibling thread names

From: Andi Kleen
Date: Fri Oct 23 2009 - 23:54:49 EST


On Wed, Oct 21, 2009 at 07:48:22PM -0700, Arjan van de Ven wrote:
> On Thu, 22 Oct 2009 02:49:19 +0200
> Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
>
> > > you're pretty much the first now who touches ->comm from
> > > not-the-thread-itself.... are you sure that is safe?
> >
> > It's not, there is no locking. On the other hand nothing should crash,
> > just users might see half rewritten data.
>
> .. with strings this is tricky though.. if the new string is longer
> than the old one the terminating zero might just be missed etc.

Good point.
He needs to first set the last byte to zero to avoid that.
But better probably to do a proper lock on all readers. Or not add
this feature at all (does it have a strong use case?)
-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/