<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel, branch v3.4.22</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/kernel?h=v3.4.22</id>
<link rel='self' href='https://git.amat.us/linux/atom/kernel?h=v3.4.22'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-12-03T19:47:23Z</updated>
<entry>
<title>timekeeping: Cast raw_interval to u64 to avoid shift overflow</title>
<updated>2012-12-03T19:47:23Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2012-10-09T07:18:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1103ef8e70a1725b7fd9e0cb18a8b1edb6e5c42d'/>
<id>urn:sha1:1103ef8e70a1725b7fd9e0cb18a8b1edb6e5c42d</id>
<content type='text'>
commit 5b3900cd409466c0070b234d941650685ad0c791 upstream.

We fixed a bunch of integer overflows in timekeeping code during the 3.6
cycle.  I did an audit based on that and found this potential overflow.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Acked-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Link: http://lkml.kernel.org/r/20121009071823.GA19159@elgon.mountain
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Ben Hutchings &lt;ben@decadent.org.uk&gt;
[ herton: adapt for 3.5, timekeeper instead of tk pointer ]
Signed-off-by: Herton Ronaldo Krzesinski &lt;herton.krzesinski@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>watchdog: using u64 in get_sample_period()</title>
<updated>2012-12-03T19:47:17Z</updated>
<author>
<name>Chuansheng Liu</name>
<email>chuansheng.liu@intel.com</email>
</author>
<published>2012-11-27T00:29:54Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=53b360c604575070c83d2da83636af4e5c5de35a'/>
<id>urn:sha1:53b360c604575070c83d2da83636af4e5c5de35a</id>
<content type='text'>
commit 8ffeb9b0e6369135bf03a073514f571ef10606b9 upstream.

In get_sample_period(), unsigned long is not enough:

  watchdog_thresh * 2 * (NSEC_PER_SEC / 5)

case1:
  watchdog_thresh is 10 by default, the sample value will be: 0xEE6B2800

case2:
 set watchdog_thresh is 20, the sample value will be: 0x1 DCD6 5000

In case2, we need use u64 to express the sample period.  Otherwise,
changing the threshold thru proc often can not be successful.

Signed-off-by: liu chuansheng &lt;chuansheng.liu@intel.com&gt;
Acked-by: Don Zickus &lt;dzickus@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Shuah Khan &lt;shuah.khan@hp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>futex: avoid wake_futex() for a PI futex_q</title>
<updated>2012-12-03T19:47:07Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhart@linux.intel.com</email>
</author>
<published>2012-11-27T00:29:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fceca5e72e787dd0a8ea29e22a874e363389356c'/>
<id>urn:sha1:fceca5e72e787dd0a8ea29e22a874e363389356c</id>
<content type='text'>
commit aa10990e028cac3d5e255711fb9fb47e00700e35 upstream.

Dave Jones reported a bug with futex_lock_pi() that his trinity test
exposed.  Sometime between queue_me() and taking the q.lock_ptr, the
lock_ptr became NULL, resulting in a crash.

While futex_wake() is careful to not call wake_futex() on futex_q's with
a pi_state or an rt_waiter (which are either waiting for a
futex_unlock_pi() or a PI futex_requeue()), futex_wake_op() and
futex_requeue() do not perform the same test.

Update futex_wake_op() and futex_requeue() to test for q.pi_state and
q.rt_waiter and abort with -EINVAL if detected.  To ensure any future
breakage is caught, add a WARN() to wake_futex() if the same condition
is true.

This fix has seen 3 hours of testing with "trinity -c futex" on an
x86_64 VM with 4 CPUS.

[akpm@linux-foundation.org: tidy up the WARN()]
Signed-off-by: Darren Hart &lt;dvhart@linux.intel.com&gt;
Reported-by: Dave Jones &lt;davej@redat.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: John Kacur &lt;jkacur@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>module: fix out-by-one error in kallsyms</title>
<updated>2012-11-26T19:37:41Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2012-10-25T00:19:25Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0de578d014506a662b239708f4a0ded7e083292c'/>
<id>urn:sha1:0de578d014506a662b239708f4a0ded7e083292c</id>
<content type='text'>
commit 59ef28b1f14899b10d6b2682c7057ca00a9a3f47 upstream.

Masaki found and patched a kallsyms issue: the last symbol in a
module's symtab wasn't transferred.  This is because we manually copy
the zero'th entry (which is always empty) then copy the rest in a loop
starting at 1, though from src[0].  His fix was minimal, I prefer to
rewrite the loops in more standard form.

There are two loops: one to get the size, and one to copy.  Make these
identical: always count entry 0 and any defined symbol in an allocated
non-init section.

This bug exists since the following commit was introduced.
   module: reduce symbol table for loaded modules (v2)
   commit: 4a4962263f07d14660849ec134ee42b63e95ea9a

LKML: http://lkml.org/lkml/2012/10/24/27
Reported-by: Masaki Kimura &lt;masaki.kimura.kz@hitachi.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>futex: Handle futex_pi OWNER_DIED take over correctly</title>
<updated>2012-11-17T21:16:22Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2012-10-23T20:29:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c4cbedfda2227df82126c9dd5e7593565bf45d21'/>
<id>urn:sha1:c4cbedfda2227df82126c9dd5e7593565bf45d21</id>
<content type='text'>
commit 59fa6245192159ab5e1e17b8e31f15afa9cff4bf upstream.

Siddhesh analyzed a failure in the take over of pi futexes in case the
owner died and provided a workaround.
See: http://sourceware.org/bugzilla/show_bug.cgi?id=14076

The detailed problem analysis shows:

Futex F is initialized with PTHREAD_PRIO_INHERIT and
PTHREAD_MUTEX_ROBUST_NP attributes.

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --&gt; T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --&gt; exit_robust_list() runs
       --&gt; Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --&gt; Succeeds due to the check for F's userspace TID field == 0
   --&gt; Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --&gt; returns to user space

T1 --&gt; exit_pi_state_list()
       --&gt; Transfers pi_state to waiter T2 and wakes T2 via
       	   rt_mutex_unlock(&amp;pi_state-&gt;mutex)

T2 --&gt; acquires pi_state-&gt;mutex and gains real ownership of the
       pi_state
   --&gt; Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --&gt; returns to user space

T3 --&gt; observes inconsistent state

This problem is independent of UP/SMP, preemptible/non preemptible
kernels, or process shared vs. private. The only difference is that
certain configurations are more likely to expose it.

So as Siddhesh correctly analyzed the following check in
futex_lock_pi_atomic() is the culprit:

	if (unlikely(ownerdied || !(curval &amp; FUTEX_TID_MASK))) {

We check the userspace value for a TID value of 0 and take over the
futex unconditionally if that's true.

AFAICT this check is there as it is correct for a different corner
case of futexes: the WAITERS bit became stale.

Now the proposed change

-	if (unlikely(ownerdied || !(curval &amp; FUTEX_TID_MASK))) {
+       if (unlikely(ownerdied ||
+                       !(curval &amp; (FUTEX_TID_MASK | FUTEX_WAITERS)))) {

solves the problem, but it's not obvious why and it wreckages the
"stale WAITERS bit" case.

What happens is, that due to the WAITERS bit being set (T2 is blocked
on that futex) it enforces T3 to go through lookup_pi_state(), which
in the above case returns an existing pi_state and therefor forces T3
to legitimately fight with T2 over the ownership of the pi_state (via
pi_state-&gt;mutex). Probelm solved!

Though that does not work for the "WAITERS bit is stale" problem
because if lookup_pi_state() does not find existing pi_state it
returns -ERSCH (due to TID == 0) which causes futex_lock_pi() to
return -ESRCH to user space because the OWNER_DIED bit is not set.

Now there is a different solution to that problem. Do not look at the
user space value at all and enforce a lookup of possibly available
pi_state. If pi_state can be found, then the new incoming locker T3
blocks on that pi_state and legitimately races with T2 to acquire the
rt_mutex and the pi_state and therefor the proper ownership of the
user space futex.

lookup_pi_state() has the correct order of checks. It first tries to
find a pi_state associated with the user space futex and only if that
fails it checks for futex TID value = 0. If no pi_state is available
nothing can create new state at that point because this happens with
the hash bucket lock held.

So the above scenario changes to:

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --&gt; T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --&gt; exit_robust_list() runs
       --&gt; Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --&gt; Finds pi_state and blocks on pi_state-&gt;rt_mutex

T1 --&gt; exit_pi_state_list()
       --&gt; Transfers pi_state to waiter T2 and wakes it via
       	   rt_mutex_unlock(&amp;pi_state-&gt;mutex)

T2 --&gt; acquires pi_state-&gt;mutex and gains ownership of the pi_state
   --&gt; Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --&gt; returns to user space

This covers all gazillion points on which T3 might come in between
T1's exit_robust_list() clearing the TID field and T2 fixing it up. It
also solves the "WAITERS bit stale" problem by forcing the take over.

Another benefit of changing the code this way is that it makes it less
dependent on untrusted user space values and therefor minimizes the
possible wreckage which might be inflicted.

As usual after staring for too long at the futex code my brain hurts
so much that I really want to ditch that whole optimization of
avoiding the syscall for the non contended case for PI futexes and rip
out the maze of corner case handling code. Unfortunately we can't as
user space relies on that existing behaviour, but at least thinking
about it helps me to preserve my mental sanity. Maybe we should
nevertheless :)

Reported-and-tested-by: Siddhesh Poyarekar &lt;siddhesh.poyarekar@gmail.com&gt;
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1210232138540.2756@ionos
Acked-by: Darren Hart &lt;dvhart@linux.intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Revert "cgroup: Drop task_lock(parent) on cgroup_fork()"</title>
<updated>2012-10-28T17:14:14Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-10-19T00:52:07Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=727fa37e405a71dc1c7208ea7352be55e0310eca'/>
<id>urn:sha1:727fa37e405a71dc1c7208ea7352be55e0310eca</id>
<content type='text'>
commit 9bb71308b8133d643648776243e4d5599b1c193d upstream.

This reverts commit 7e381b0eb1e1a9805c37335562e8dc02e7d7848c.

The commit incorrectly assumed that fork path always performed
threadgroup_change_begin/end() and depended on that for
synchronization against task exit and cgroup migration paths instead
of explicitly grabbing task_lock().

threadgroup_change is not locked when forking a new process (as
opposed to a new thread in the same process) and even if it were it
wouldn't be effective as different processes use different threadgroup
locks.

Revert the incorrect optimization.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
LKML-Reference: &lt;20121008020000.GB2575@localhost&gt;
Acked-by: Li Zefan &lt;lizefan@huawei.com&gt;
Bitterly-Acked-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Revert "cgroup: Remove task_lock() from cgroup_post_fork()"</title>
<updated>2012-10-28T17:14:14Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-10-19T00:40:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5993bba302a1a6df9c73690a08346411ff7cd56e'/>
<id>urn:sha1:5993bba302a1a6df9c73690a08346411ff7cd56e</id>
<content type='text'>
commit d87838321124061f6c935069d97f37010fa417e6 upstream.

This reverts commit 7e3aa30ac8c904a706518b725c451bb486daaae9.

The commit incorrectly assumed that fork path always performed
threadgroup_change_begin/end() and depended on that for
synchronization against task exit and cgroup migration paths instead
of explicitly grabbing task_lock().

threadgroup_change is not locked when forking a new process (as
opposed to a new thread in the same process) and even if it were it
wouldn't be effective as different processes use different threadgroup
locks.

Revert the incorrect optimization.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
LKML-Reference: &lt;20121008020000.GB2575@localhost&gt;
Acked-by: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>cgroup: notify_on_release may not be triggered in some cases</title>
<updated>2012-10-28T17:14:14Z</updated>
<author>
<name>Daisuke Nishimura</name>
<email>nishimura@mxp.nes.nec.co.jp</email>
</author>
<published>2012-10-04T07:37:16Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9a55fef20afb3d7362b0c9d19ba1e78dfe482d3d'/>
<id>urn:sha1:9a55fef20afb3d7362b0c9d19ba1e78dfe482d3d</id>
<content type='text'>
commit 1f5320d5972aa50d3e8d2b227b636b370e608359 upstream.

notify_on_release must be triggered when the last process in a cgroup is
move to another. But if the first(and only) process in a cgroup is moved to
another, notify_on_release is not triggered.

	# mkdir /cgroup/cpu/SRC
	# mkdir /cgroup/cpu/DST
	#
	# echo 1 &gt;/cgroup/cpu/SRC/notify_on_release
	# echo 1 &gt;/cgroup/cpu/DST/notify_on_release
	#
	# sleep 300 &amp;
	[1] 8629
	#
	# echo 8629 &gt;/cgroup/cpu/SRC/tasks
	# echo 8629 &gt;/cgroup/cpu/DST/tasks
	-&gt; notify_on_release for /SRC must be triggered at this point,
	   but it isn't.

This is because put_css_set() is called before setting CGRP_RELEASABLE
in cgroup_task_migrate(), and is a regression introduce by the
commit:74a1166d(cgroups: make procs file writable), which was merged
into v3.0.

Acked-by: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: Ben Blum &lt;bblum@andrew.cmu.edu&gt;
Signed-off-by: Daisuke Nishimura &lt;nishimura@mxp.nes.nec.co.jp&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>use clamp_t in UNAME26 fix</title>
<updated>2012-10-28T17:14:13Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2012-10-20T01:45:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3680030e9747dfa51fe9c1850361c29ae0ad20fe'/>
<id>urn:sha1:3680030e9747dfa51fe9c1850361c29ae0ad20fe</id>
<content type='text'>
commit 31fd84b95eb211d5db460a1dda85e004800a7b52 upstream.

The min/max call needed to have explicit types on some architectures
(e.g. mn10300). Use clamp_t instead to avoid the warning:

  kernel/sys.c: In function 'override_release':
  kernel/sys.c:1287:10: warning: comparison of distinct pointer types lacks a cast [enabled by default]

Reported-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>kernel/sys.c: fix stack memory content leak via UNAME26</title>
<updated>2012-10-28T17:14:13Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2012-10-19T20:56:51Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=643fde8ed4ea75f5d113803084806eff14d97454'/>
<id>urn:sha1:643fde8ed4ea75f5d113803084806eff14d97454</id>
<content type='text'>
commit 2702b1526c7278c4d65d78de209a465d4de2885e upstream.

Calling uname() with the UNAME26 personality set allows a leak of kernel
stack contents.  This fixes it by defensively calculating the length of
copy_to_user() call, making the len argument unsigned, and initializing
the stack buffer to zero (now technically unneeded, but hey, overkill).

CVE-2012-0957

Reported-by: PaX Team &lt;pageexec@freemail.hu&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: PaX Team &lt;pageexec@freemail.hu&gt;
Cc: Brad Spengler &lt;spender@grsecurity.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
