lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201401111209.IEG82331.OtVQLFOFHMOSFJ@I-love.SAKURA.ne.jp>
Date:	Sat, 11 Jan 2014 12:09:46 +0900
From:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To:	akpm@...ux-foundation.org, paulmck@...ux.vnet.ibm.com
Cc:	pavel@....cz, joe@...ches.com, keescook@...omium.org,
	geert@...ux-m68k.org, jkosina@...e.cz, viro@...iv.linux.org.uk,
	davem@...emloft.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/vsprintf: add %pT format specifier

Andrew Morton wrote:
> In the absence of step 3, steps 1 and 2 are rather pointless churn.
> 
> So I think it would be better to merge (into mainline) steps 1 and 3
> first and at the same time.  Then start thinking about step 2.

Unfortunately we can't.
Step 2 depends on step 1 for avoiding compile time errors.
Step 3 depends on step 2 for avoiding run time errors.

  Step 1: (targeted to 3.14-rc1)
    Add "%pT" format specifier and commcpy() wrapper function.

  Step 2: (started after step 1 is reflected to other git trees)
    Replace printk("%s", current->comm) with printk("%pT", NULL).
    Replace printk("%s", p->comm) with printk("%pT", p).
    Replace strcpy(buf, p->comm) with commcpy(buf, p).

  Step 3: (started after step 2 is reflected to other git trees)
    Add rcu_read_lock()/rcu_read_unlock() into commcpy().
    Modify set_task_comm() etc. to replace ->comm using RCU.

If step 3 is merged into mainline before step 2 complete, those who are not
using "%pT" or commcpy() might crash due to reading RCU protected ->comm
without rcu_read_lock()/rcu_read_unlock().


Let me confirm, Paul.

  I'm trying to change task_struct->comm to use RCU.
  At step 3, I'm planning to do

  static inline void *commcpy(void *buf, const struct task_struct *tsk)
  {
  	rcu_read_lock();
  	memcpy(buf, tsk->comm, TASK_COMM_LEN);
  	rcu_read_unlock();
  	return buf;
  }

  and let set_task_comm() wait for readers using synchronize_rcu() or
  call_rcu().

  Given that commcpy() can be called from any context, are synchronize_rcu()
  and call_rcu() sufficient for waiting for commcpy() users?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ