Skip to content

Commit 34c5c89

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "10 patches. Subsystems affected by this patch series: mm (pagealloc, gup, kasan, and userfaultfd), ipc, selftests, watchdog, bitmap, procfs, and lib" * emailed patches from Andrew Morton <[email protected]>: userfaultfd: hugetlbfs: fix new flag usage in error path lib: kunit: suppress a compilation warning of frame size proc: remove Alexey from MAINTAINERS linux/bits.h: fix compilation error with GENMASK watchdog: reliable handling of timestamps kasan: slab: always reset the tag in get_freepointer_safe() tools/testing/selftests/exec: fix link error ipc/mqueue, msg, sem: avoid relying on a stack reference past its expiry Revert "mm/gup: check page posion status for coredump." mm/shuffle: fix section mismatch warning
2 parents 4ff2473 + e32905e commit 34c5c89

File tree

18 files changed

+74
-75
lines changed

18 files changed

+74
-75
lines changed

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14735,7 +14735,6 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/p54
1473514735
F: drivers/net/wireless/intersil/prism54/
1473614736

1473714737
PROC FILESYSTEM
14738-
R: Alexey Dobriyan <[email protected]>
1473914738
1474014739
1474114740
S: Maintained

fs/hugetlbfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
529529
* the subpool and global reserve usage count can need
530530
* to be adjusted.
531531
*/
532-
VM_BUG_ON(PagePrivate(page));
532+
VM_BUG_ON(HPageRestoreReserve(page));
533533
remove_huge_page(page);
534534
freed++;
535535
if (!truncate_op) {

include/linux/bits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <linux/build_bug.h>
2323
#define GENMASK_INPUT_CHECK(h, l) \
2424
(BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
25-
__builtin_constant_p((l) > (h)), (l) > (h), 0)))
25+
__is_constexpr((l) > (h)), (l) > (h), 0)))
2626
#else
2727
/*
2828
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,

include/linux/const.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@
33

44
#include <vdso/const.h>
55

6+
/*
7+
* This returns a constant expression while determining if an argument is
8+
* a constant expression, most importantly without evaluating the argument.
9+
* Glory to Martin Uecker <[email protected]>
10+
*/
11+
#define __is_constexpr(x) \
12+
(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
13+
614
#endif /* _LINUX_CONST_H */

include/linux/minmax.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef _LINUX_MINMAX_H
33
#define _LINUX_MINMAX_H
44

5+
#include <linux/const.h>
6+
57
/*
68
* min()/max()/clamp() macros must accomplish three things:
79
*
@@ -17,14 +19,6 @@
1719
#define __typecheck(x, y) \
1820
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
1921

20-
/*
21-
* This returns a constant expression while determining if an argument is
22-
* a constant expression, most importantly without evaluating the argument.
23-
* Glory to Martin Uecker <[email protected]>
24-
*/
25-
#define __is_constexpr(x) \
26-
(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
27-
2822
#define __no_side_effects(x, y) \
2923
(__is_constexpr(x) && __is_constexpr(y))
3024

ipc/mqueue.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,14 @@ static inline void __pipelined_op(struct wake_q_head *wake_q,
10041004
struct mqueue_inode_info *info,
10051005
struct ext_wait_queue *this)
10061006
{
1007+
struct task_struct *task;
1008+
10071009
list_del(&this->list);
1008-
get_task_struct(this->task);
1010+
task = get_task_struct(this->task);
10091011

10101012
/* see MQ_BARRIER for purpose/pairing */
10111013
smp_store_release(&this->state, STATE_READY);
1012-
wake_q_add_safe(wake_q, this->task);
1014+
wake_q_add_safe(wake_q, task);
10131015
}
10141016

10151017
/* pipelined_send() - send a message directly to the task waiting in

ipc/msg.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,13 @@ static void expunge_all(struct msg_queue *msq, int res,
251251
struct msg_receiver *msr, *t;
252252

253253
list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
254-
get_task_struct(msr->r_tsk);
254+
struct task_struct *r_tsk;
255+
256+
r_tsk = get_task_struct(msr->r_tsk);
255257

256258
/* see MSG_BARRIER for purpose/pairing */
257259
smp_store_release(&msr->r_msg, ERR_PTR(res));
258-
wake_q_add_safe(wake_q, msr->r_tsk);
260+
wake_q_add_safe(wake_q, r_tsk);
259261
}
260262
}
261263

ipc/sem.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,12 +784,14 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
784784
static inline void wake_up_sem_queue_prepare(struct sem_queue *q, int error,
785785
struct wake_q_head *wake_q)
786786
{
787-
get_task_struct(q->sleeper);
787+
struct task_struct *sleeper;
788+
789+
sleeper = get_task_struct(q->sleeper);
788790

789791
/* see SEM_BARRIER_2 for purpose/pairing */
790792
smp_store_release(&q->status, error);
791793

792-
wake_q_add_safe(wake_q, q->sleeper);
794+
wake_q_add_safe(wake_q, sleeper);
793795
}
794796

795797
static void unlink_queue(struct sem_array *sma, struct sem_queue *q)

kernel/watchdog.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ void touch_softlockup_watchdog_sync(void)
302302
__this_cpu_write(watchdog_report_ts, SOFTLOCKUP_DELAY_REPORT);
303303
}
304304

305-
static int is_softlockup(unsigned long touch_ts, unsigned long period_ts)
305+
static int is_softlockup(unsigned long touch_ts,
306+
unsigned long period_ts,
307+
unsigned long now)
306308
{
307-
unsigned long now = get_timestamp();
308-
309309
if ((watchdog_enabled & SOFT_WATCHDOG_ENABLED) && watchdog_thresh){
310310
/* Warn about unreasonable delays. */
311311
if (time_after(now, period_ts + get_softlockup_thresh()))
@@ -353,8 +353,7 @@ static int softlockup_fn(void *data)
353353
/* watchdog kicker functions */
354354
static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
355355
{
356-
unsigned long touch_ts = __this_cpu_read(watchdog_touch_ts);
357-
unsigned long period_ts = __this_cpu_read(watchdog_report_ts);
356+
unsigned long touch_ts, period_ts, now;
358357
struct pt_regs *regs = get_irq_regs();
359358
int duration;
360359
int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace;
@@ -376,12 +375,23 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
376375
/* .. and repeat */
377376
hrtimer_forward_now(hrtimer, ns_to_ktime(sample_period));
378377

378+
/*
379+
* Read the current timestamp first. It might become invalid anytime
380+
* when a virtual machine is stopped by the host or when the watchog
381+
* is touched from NMI.
382+
*/
383+
now = get_timestamp();
379384
/*
380385
* If a virtual machine is stopped by the host it can look to
381-
* the watchdog like a soft lockup. Check to see if the host
382-
* stopped the vm before we process the timestamps.
386+
* the watchdog like a soft lockup. This function touches the watchdog.
383387
*/
384388
kvm_check_and_clear_guest_paused();
389+
/*
390+
* The stored timestamp is comparable with @now only when not touched.
391+
* It might get touched anytime from NMI. Make sure that is_softlockup()
392+
* uses the same (valid) value.
393+
*/
394+
period_ts = READ_ONCE(*this_cpu_ptr(&watchdog_report_ts));
385395

386396
/* Reset the interval when touched by known problematic code. */
387397
if (period_ts == SOFTLOCKUP_DELAY_REPORT) {
@@ -398,13 +408,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
398408
return HRTIMER_RESTART;
399409
}
400410

401-
/* check for a softlockup
402-
* This is done by making sure a high priority task is
403-
* being scheduled. The task touches the watchdog to
404-
* indicate it is getting cpu time. If it hasn't then
405-
* this is a good indication some task is hogging the cpu
406-
*/
407-
duration = is_softlockup(touch_ts, period_ts);
411+
/* Check for a softlockup. */
412+
touch_ts = __this_cpu_read(watchdog_touch_ts);
413+
duration = is_softlockup(touch_ts, period_ts, now);
408414
if (unlikely(duration)) {
409415
/*
410416
* Prevent multiple soft-lockup reports if one cpu is already

lib/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ obj-$(CONFIG_OBJAGG) += objagg.o
348348
obj-$(CONFIG_PLDMFW) += pldmfw/
349349

350350
# KUnit tests
351+
CFLAGS_bitfield_kunit.o := $(call cc-option,-Wframe-larger-than=10240)
351352
obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o
352353
obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o
353354
obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o

0 commit comments

Comments
 (0)