From mboxrd@z Thu Jan 1 00:00:00 1970 From: Artem Bityutskiy Subject: Re: [PATCH] sanitize task->comm to avoid leaking escape codes Date: Tue, 29 Jun 2010 07:58:25 +0300 Message-ID: <1277787505.3599.25.camel@localhost.localdomain> References: <20100623181129.GM5876@outflux.net> <20100623194145.GA19628@redhat.com> Reply-To: dedekind1@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Kees Cook , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro , Andrew Morton , KOSAKI Motohiro , Neil Horman , Roland McGrath , Ingo Molnar , Peter Zijlstra , Thomas Gleixner To: Oleg Nesterov , john stultz Return-path: Received: from mail-fx0-f46.google.com ([209.85.161.46]:43109 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223Ab0F2E6b (ORCPT ); Tue, 29 Jun 2010 00:58:31 -0400 In-Reply-To: <20100623194145.GA19628@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 2010-06-23 at 21:41 +0200, Oleg Nesterov wrote: > On 06/23, Kees Cook wrote: > > > > @@ -956,7 +957,15 @@ void set_task_comm(struct task_struct *tsk, ch= ar *buf) > > */ > > memset(tsk->comm, 0, TASK_COMM_LEN); > > wmb(); >=20 > Off-topic. I'd wish I could understand this barrier. Since the lockle= ss > reader doesn't do rmb() I don't see how this can help. This wmb() looks wrong to me as well. To achieve what the comment in this function says, it should be smp_wmb() and we should have smp_rmb() in the reading side, AFAIU. > OTOH, I don't > understand why it is needed, we never change ->comm[TASK_COMM_LEN-1] = =3D=3D '0'. I think the idea was that readers can see incomplete names, but not messed up names, consisting of old and new ones. --=20 Best Regards, Artem Bityutskiy (=D0=90=D1=80=D1=82=D1=91=D0=BC =D0=91=D0=B8=D1=82=D1=8E= =D1=86=D0=BA=D0=B8=D0=B9) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html