Skip to content

Commit f6eb0fe

Browse files
committed
Merge tag 'timers-urgent-2022-08-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Ingo Molnar: "Misc timer fixes: - fix a potential use-after-free bug in posix timers - correct a prototype - address a build warning" * tag 'timers-urgent-2022-08-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: posix-cpu-timers: Cleanup CPU timers before freeing them during exec time: Correct the prototype of ns_to_kernel_old_timeval and ns_to_timespec64 posix-timers: Make do_clock_gettime() static
2 parents c5f1e32 + e362359 commit f6eb0fe

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

fs/exec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,9 @@ int begin_new_exec(struct linux_binprm * bprm)
13041304
bprm->mm = NULL;
13051305

13061306
#ifdef CONFIG_POSIX_TIMERS
1307+
spin_lock_irq(&me->sighand->siglock);
1308+
posix_cpu_timers_exit(me);
1309+
spin_unlock_irq(&me->sighand->siglock);
13071310
exit_itimers(me);
13081311
flush_itimer_signals();
13091312
#endif

include/linux/time64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static inline s64 timespec64_to_ns(const struct timespec64 *ts)
145145
*
146146
* Returns the timespec64 representation of the nsec parameter.
147147
*/
148-
extern struct timespec64 ns_to_timespec64(const s64 nsec);
148+
extern struct timespec64 ns_to_timespec64(s64 nsec);
149149

150150
/**
151151
* timespec64_add_ns - Adds nanoseconds to a timespec64

kernel/time/posix-stubs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
7070
return do_sys_settimeofday64(&new_tp, NULL);
7171
}
7272

73-
int do_clock_gettime(clockid_t which_clock, struct timespec64 *tp)
73+
static int do_clock_gettime(clockid_t which_clock, struct timespec64 *tp)
7474
{
7575
switch (which_clock) {
7676
case CLOCK_REALTIME:
@@ -90,6 +90,7 @@ int do_clock_gettime(clockid_t which_clock, struct timespec64 *tp)
9090

9191
return 0;
9292
}
93+
9394
SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
9495
struct __kernel_timespec __user *, tp)
9596
{

kernel/time/time.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ time64_t mktime64(const unsigned int year0, const unsigned int mon0,
449449
}
450450
EXPORT_SYMBOL(mktime64);
451451

452-
struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)
452+
struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec)
453453
{
454454
struct timespec64 ts = ns_to_timespec64(nsec);
455455
struct __kernel_old_timeval tv;
@@ -503,7 +503,7 @@ EXPORT_SYMBOL(set_normalized_timespec64);
503503
*
504504
* Returns the timespec64 representation of the nsec parameter.
505505
*/
506-
struct timespec64 ns_to_timespec64(const s64 nsec)
506+
struct timespec64 ns_to_timespec64(s64 nsec)
507507
{
508508
struct timespec64 ts = { 0, 0 };
509509
s32 rem;

0 commit comments

Comments
 (0)