Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2f7d08

Browse files
avaginKAGA-KOKO
authored andcommitted
futex: Adjust absolute futex timeouts with per time namespace offset
For all commands except FUTEX_WAIT, the timeout is interpreted as anabsolute value. This absolute value is inside the task's time namespace andhas to be converted to the host's time.Fixes:5a590f3 ("posix-clocks: Wire up clock_gettime() with timens offsets")Reported-by: Hans van der Laan <j.h.vanderlaan@student.utwente.nl>Signed-off-by: Andrei Vagin <avagin@gmail.com>Signed-off-by: Thomas Gleixner <tglx@linutronix.de>Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>Cc: <stable@vger.kernel.org>Link:https://lore.kernel.org/r/20201015160020.293748-1-avagin@gmail.com
1 parent270315b commitc2f7d08

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎kernel/futex.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include<linux/freezer.h>
4040
#include<linux/memblock.h>
4141
#include<linux/fault-inject.h>
42+
#include<linux/time_namespace.h>
4243

4344
#include<asm/futex.h>
4445

@@ -3797,6 +3798,8 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
37973798
t=timespec64_to_ktime(ts);
37983799
if (cmd==FUTEX_WAIT)
37993800
t=ktime_add_safe(ktime_get(),t);
3801+
elseif (!(op&FUTEX_CLOCK_REALTIME))
3802+
t=timens_ktime_to_host(CLOCK_MONOTONIC,t);
38003803
tp=&t;
38013804
}
38023805
/*
@@ -3989,6 +3992,8 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
39893992
t=timespec64_to_ktime(ts);
39903993
if (cmd==FUTEX_WAIT)
39913994
t=ktime_add_safe(ktime_get(),t);
3995+
elseif (!(op&FUTEX_CLOCK_REALTIME))
3996+
t=timens_ktime_to_host(CLOCK_MONOTONIC,t);
39923997
tp=&t;
39933998
}
39943999
if (cmd==FUTEX_REQUEUE||cmd==FUTEX_CMP_REQUEUE||

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp