diff options
author | Shan Hai <shan.hai@windriver.com> | 2012-11-08 15:57:49 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 08:43:53 -0800 |
commit | aea63e0027f3eb9ff17fd0b6a4a528d91e9e820f (patch) | |
tree | a4f45b2a04bec6892e0669521f367e70a3364efc /drivers/s390/cio | |
parent | dc22f2dc55c1b395db33a2695f5f356726800c6a (diff) | |
download | kernel_samsung_smdk4412-aea63e0027f3eb9ff17fd0b6a4a528d91e9e820f.zip kernel_samsung_smdk4412-aea63e0027f3eb9ff17fd0b6a4a528d91e9e820f.tar.gz kernel_samsung_smdk4412-aea63e0027f3eb9ff17fd0b6a4a528d91e9e820f.tar.bz2 |
powerpc/vdso: Remove redundant locking in update_vsyscall_tz()
commit ce73ec6db47af84d1466402781ae0872a9e7873c upstream.
The locking in update_vsyscall_tz() is not only unnecessary because the vdso
code copies the data unproteced in __kernel_gettimeofday() but also
introduces a hard to reproduce race condition between update_vsyscall()
and update_vsyscall_tz(), which causes user space process to loop
forever in vdso code.
The following patch removes the locking from update_vsyscall_tz().
Locking is not only unnecessary because the vdso code copies the data
unprotected in __kernel_gettimeofday() but also erroneous because updating
the tb_update_count is not atomic and introduces a hard to reproduce race
condition between update_vsyscall() and update_vsyscall_tz(), which further
causes user space process to loop forever in vdso code.
The below scenario describes the race condition,
x==0 Boot CPU other CPU
proc_P: x==0
timer interrupt
update_vsyscall
x==1 x++;sync settimeofday
update_vsyscall_tz
x==2 x++;sync
x==3 sync;x++
sync;x++
proc_P: x==3 (loops until x becomes even)
Because the ++ operator would be implemented as three instructions and not
atomic on powerpc.
A similar change was made for x86 in commit 6c260d58634
("x86: vdso: Remove bogus locking in update_vsyscall_tz")
Signed-off-by: Shan Hai <shan.hai@windriver.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/s390/cio')
0 files changed, 0 insertions, 0 deletions