Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1231292

Re: [patch] mm, oom: remove task_lock protecting comm printing

From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: [patch] mm, oom: remove task_lock protecting comm printing
Date 2015-09-23 11:50 +0200
Message-ID <qbOQy-mP-13@gated-at.bofh.it> (permalink)
References <qbFkf-3rQ-9@gated-at.bofh.it> <qbNhL-6K3-3@gated-at.bofh.it> <qbOnw-8gf-13@gated-at.bofh.it> <qbOGS-bd-39@gated-at.bofh.it> <qbOQy-mP-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On (09/23/15 11:43), Michal Hocko wrote:
[..]
> > > the previous name was already null terminated,
> > 
> > Yeah, but if the old name is shorter than the new one, set_task_comm()
> > overwrites the terminating null of the old name before writing the new
> > terminating null, so there is a short time window during which tsk->comm
> > might be not null-terminated, no?
> 
> Not really:
>         case PR_SET_NAME:
>                 comm[sizeof(me->comm) - 1] = 0;
>                 if (strncpy_from_user(comm, (char __user *)arg2,
>                                       sizeof(me->comm) - 1) < 0)
>                         return -EFAULT;
> 
> So it first writes the terminating 0 and only then starts copying.

right.

hm, shouldn't set_task_comm()->__set_task_comm() do the same?

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch] mm, oom: remove task_lock protecting comm printing David Rientjes <rientjes@google.com> - 2015-09-23 01:40 +0200
  Re: [patch] mm, oom: remove task_lock protecting comm printing Michal Hocko <mhocko@kernel.org> - 2015-09-23 09:50 +0200
  Re: [patch] mm, oom: remove task_lock protecting comm printing Vladimir Davydov <vdavydov@parallels.com> - 2015-09-23 10:10 +0200
    Re: [patch] mm, oom: remove task_lock protecting comm printing Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-09-23 11:20 +0200
      Re: [patch] mm, oom: remove task_lock protecting comm printing Vladimir Davydov <vdavydov@parallels.com> - 2015-09-23 11:40 +0200
        Re: [patch] mm, oom: remove task_lock protecting comm printing Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-09-23 11:50 +0200
          Re: [patch] mm, oom: remove task_lock protecting comm printing Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-09-23 12:00 +0200
          Re: [patch] mm, oom: remove task_lock protecting comm printing Vladimir Davydov <vdavydov@parallels.com> - 2015-09-23 12:10 +0200
            Re: [patch] mm, oom: remove task_lock protecting comm printing Michal Hocko <mhocko@kernel.org> - 2015-09-23 12:50 +0200
        Re: [patch] mm, oom: remove task_lock protecting comm printing Michal Hocko <mhocko@kernel.org> - 2015-09-23 11:50 +0200
  Re: [patch] mm, oom: remove task_lock protecting comm printing Johannes Weiner <hannes@cmpxchg.org> - 2015-09-24 21:50 +0200

csiph-web