On Thu, Jan 9, 2014 at 4:52 AM, Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> wrote: > Hello. > > Since addition of %pT itself seems to be agreed, I refreshed this patch using > linux-next-20140109. Please pick up if this patch is OK for you; I will start > making patches for killing most of direct ->comm readers.
Looks good; thanks for chasing this. :) > > Regards. > ---------------------------------------- > >From 0d1f03d59a477459f3d3c190593d9e78f5d67de8 Mon Sep 17 00:00:00 2001 > From: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> > Date: Thu, 9 Jan 2014 21:32:22 +0900 > Subject: [PATCH] lib/vsprintf: add %pT format specifier > > Since task_struct->comm can be modified by other threads while the current > thread is reading it, it is recommended to use get_task_comm() for reading it. > > However, since get_task_comm() holds task_struct->alloc_lock spinlock, > some users cannot use get_task_comm(). Also, a lot of users are directly > reading from task_struct->comm even if they can use get_task_comm(). > Such users might obtain inconsistent result. > > This patch introduces %pT format specifier for printing task_struct->comm. > Currently %pT does not provide consistency. I'm planning to change to use RCU > in the future. By using RCU, the comm name read from task_struct->comm will be > guaranteed to be consistent. But before modifying set_task_comm() to use RCU, > we need to kill direct ->comm users who do not use get_task_comm(). > > An example for converting direct ->comm users is shown below. Since many debug > printings use p == current, you can pass NULL instead of p if p == current. > > pr_info("comm=%s\n", p->comm); => pr_info("comm=%pT\n", p); > pr_info("comm=%s\n", current->comm); => pr_info("comm=%pT\n", NULL); > > Signed-off-by: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> > Reviewed-by: Pavel Machek <pa...@ucw.cz> Reviewed-by: Kees Cook <keesc...@chromium.org> -Kees -- Kees Cook Chrome OS Security -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/