Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <akpm@linux-foundation.org>:
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

+74 -75
-1
MAINTAINERS
··· 14735 14735 F: drivers/net/wireless/intersil/prism54/ 14736 14736 14737 14737 PROC FILESYSTEM 14738 - R: Alexey Dobriyan <adobriyan@gmail.com> 14739 14738 L: linux-kernel@vger.kernel.org 14740 14739 L: linux-fsdevel@vger.kernel.org 14741 14740 S: Maintained
+1 -1
fs/hugetlbfs/inode.c
··· 529 529 * the subpool and global reserve usage count can need 530 530 * to be adjusted. 531 531 */ 532 - VM_BUG_ON(PagePrivate(page)); 532 + VM_BUG_ON(HPageRestoreReserve(page)); 533 533 remove_huge_page(page); 534 534 freed++; 535 535 if (!truncate_op) {
+1 -1
include/linux/bits.h
··· 22 22 #include <linux/build_bug.h> 23 23 #define GENMASK_INPUT_CHECK(h, l) \ 24 24 (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ 25 - __builtin_constant_p((l) > (h)), (l) > (h), 0))) 25 + __is_constexpr((l) > (h)), (l) > (h), 0))) 26 26 #else 27 27 /* 28 28 * BUILD_BUG_ON_ZERO is not available in h files included from asm files,
+8
include/linux/const.h
··· 3 3 4 4 #include <vdso/const.h> 5 5 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 <Martin.Uecker@med.uni-goettingen.de> 10 + */ 11 + #define __is_constexpr(x) \ 12 + (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) 13 + 6 14 #endif /* _LINUX_CONST_H */
+2 -8
include/linux/minmax.h
··· 2 2 #ifndef _LINUX_MINMAX_H 3 3 #define _LINUX_MINMAX_H 4 4 5 + #include <linux/const.h> 6 + 5 7 /* 6 8 * min()/max()/clamp() macros must accomplish three things: 7 9 * ··· 18 16 */ 19 17 #define __typecheck(x, y) \ 20 18 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) 21 - 22 - /* 23 - * This returns a constant expression while determining if an argument is 24 - * a constant expression, most importantly without evaluating the argument. 25 - * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> 26 - */ 27 - #define __is_constexpr(x) \ 28 - (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) 29 19 30 20 #define __no_side_effects(x, y) \ 31 21 (__is_constexpr(x) && __is_constexpr(y))
+4 -2
ipc/mqueue.c
··· 1004 1004 struct mqueue_inode_info *info, 1005 1005 struct ext_wait_queue *this) 1006 1006 { 1007 + struct task_struct *task; 1008 + 1007 1009 list_del(&this->list); 1008 - get_task_struct(this->task); 1010 + task = get_task_struct(this->task); 1009 1011 1010 1012 /* see MQ_BARRIER for purpose/pairing */ 1011 1013 smp_store_release(&this->state, STATE_READY); 1012 - wake_q_add_safe(wake_q, this->task); 1014 + wake_q_add_safe(wake_q, task); 1013 1015 } 1014 1016 1015 1017 /* pipelined_send() - send a message directly to the task waiting in
+4 -2
ipc/msg.c
··· 251 251 struct msg_receiver *msr, *t; 252 252 253 253 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); 255 257 256 258 /* see MSG_BARRIER for purpose/pairing */ 257 259 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); 259 261 } 260 262 } 261 263
+4 -2
ipc/sem.c
··· 784 784 static inline void wake_up_sem_queue_prepare(struct sem_queue *q, int error, 785 785 struct wake_q_head *wake_q) 786 786 { 787 - get_task_struct(q->sleeper); 787 + struct task_struct *sleeper; 788 + 789 + sleeper = get_task_struct(q->sleeper); 788 790 789 791 /* see SEM_BARRIER_2 for purpose/pairing */ 790 792 smp_store_release(&q->status, error); 791 793 792 - wake_q_add_safe(wake_q, q->sleeper); 794 + wake_q_add_safe(wake_q, sleeper); 793 795 } 794 796 795 797 static void unlink_queue(struct sem_array *sma, struct sem_queue *q)
+20 -14
kernel/watchdog.c
··· 302 302 __this_cpu_write(watchdog_report_ts, SOFTLOCKUP_DELAY_REPORT); 303 303 } 304 304 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) 306 308 { 307 - unsigned long now = get_timestamp(); 308 - 309 309 if ((watchdog_enabled & SOFT_WATCHDOG_ENABLED) && watchdog_thresh){ 310 310 /* Warn about unreasonable delays. */ 311 311 if (time_after(now, period_ts + get_softlockup_thresh())) ··· 353 353 /* watchdog kicker functions */ 354 354 static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) 355 355 { 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; 358 357 struct pt_regs *regs = get_irq_regs(); 359 358 int duration; 360 359 int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace; ··· 376 377 hrtimer_forward_now(hrtimer, ns_to_ktime(sample_period)); 377 378 378 379 /* 380 + * Read the current timestamp first. It might become invalid anytime 381 + * when a virtual machine is stopped by the host or when the watchog 382 + * is touched from NMI. 383 + */ 384 + now = get_timestamp(); 385 + /* 379 386 * If a virtual machine is stopped by the host it can look to 380 - * the watchdog like a soft lockup. Check to see if the host 381 - * stopped the vm before we process the timestamps. 387 + * the watchdog like a soft lockup. This function touches the watchdog. 382 388 */ 383 389 kvm_check_and_clear_guest_paused(); 390 + /* 391 + * The stored timestamp is comparable with @now only when not touched. 392 + * It might get touched anytime from NMI. Make sure that is_softlockup() 393 + * uses the same (valid) value. 394 + */ 395 + period_ts = READ_ONCE(*this_cpu_ptr(&watchdog_report_ts)); 384 396 385 397 /* Reset the interval when touched by known problematic code. */ 386 398 if (period_ts == SOFTLOCKUP_DELAY_REPORT) { ··· 408 398 return HRTIMER_RESTART; 409 399 } 410 400 411 - /* check for a softlockup 412 - * This is done by making sure a high priority task is 413 - * being scheduled. The task touches the watchdog to 414 - * indicate it is getting cpu time. If it hasn't then 415 - * this is a good indication some task is hogging the cpu 416 - */ 417 - duration = is_softlockup(touch_ts, period_ts); 401 + /* Check for a softlockup. */ 402 + touch_ts = __this_cpu_read(watchdog_touch_ts); 403 + duration = is_softlockup(touch_ts, period_ts, now); 418 404 if (unlikely(duration)) { 419 405 /* 420 406 * Prevent multiple soft-lockup reports if one cpu is already
+1
lib/Makefile
··· 348 348 obj-$(CONFIG_PLDMFW) += pldmfw/ 349 349 350 350 # KUnit tests 351 + CFLAGS_bitfield_kunit.o := $(call cc-option,-Wframe-larger-than=10240) 351 352 obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o 352 353 obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o 353 354 obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
-4
mm/gup.c
··· 1593 1593 FOLL_FORCE | FOLL_DUMP | FOLL_GET); 1594 1594 if (locked) 1595 1595 mmap_read_unlock(mm); 1596 - 1597 - if (ret == 1 && is_page_poisoned(page)) 1598 - return NULL; 1599 - 1600 1596 return (ret == 1) ? page : NULL; 1601 1597 } 1602 1598 #endif /* CONFIG_ELF_CORE */
-20
mm/internal.h
··· 96 96 set_page_count(page, 1); 97 97 } 98 98 99 - /* 100 - * When kernel touch the user page, the user page may be have been marked 101 - * poison but still mapped in user space, if without this page, the kernel 102 - * can guarantee the data integrity and operation success, the kernel is 103 - * better to check the posion status and avoid touching it, be good not to 104 - * panic, coredump for process fatal signal is a sample case matching this 105 - * scenario. Or if kernel can't guarantee the data integrity, it's better 106 - * not to call this function, let kernel touch the poison page and get to 107 - * panic. 108 - */ 109 - static inline bool is_page_poisoned(struct page *page) 110 - { 111 - if (PageHWPoison(page)) 112 - return true; 113 - else if (PageHuge(page) && PageHWPoison(compound_head(page))) 114 - return true; 115 - 116 - return false; 117 - } 118 - 119 99 extern unsigned long highest_memmap_pfn; 120 100 121 101 /*
+2 -2
mm/shuffle.h
··· 10 10 DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key); 11 11 extern void __shuffle_free_memory(pg_data_t *pgdat); 12 12 extern bool shuffle_pick_tail(void); 13 - static inline void shuffle_free_memory(pg_data_t *pgdat) 13 + static inline void __meminit shuffle_free_memory(pg_data_t *pgdat) 14 14 { 15 15 if (!static_branch_unlikely(&page_alloc_shuffle_key)) 16 16 return; ··· 18 18 } 19 19 20 20 extern void __shuffle_zone(struct zone *z); 21 - static inline void shuffle_zone(struct zone *z) 21 + static inline void __meminit shuffle_zone(struct zone *z) 22 22 { 23 23 if (!static_branch_unlikely(&page_alloc_shuffle_key)) 24 24 return;
+1
mm/slub.c
··· 301 301 if (!debug_pagealloc_enabled_static()) 302 302 return get_freepointer(s, object); 303 303 304 + object = kasan_reset_tag(object); 304 305 freepointer_addr = (unsigned long)object + s->offset; 305 306 copy_from_kernel_nofault(&p, (void **)freepointer_addr, sizeof(p)); 306 307 return freelist_ptr(s, p, freepointer_addr);
+14 -14
mm/userfaultfd.c
··· 360 360 * If a reservation for the page existed in the reservation 361 361 * map of a private mapping, the map was modified to indicate 362 362 * the reservation was consumed when the page was allocated. 363 - * We clear the PagePrivate flag now so that the global 363 + * We clear the HPageRestoreReserve flag now so that the global 364 364 * reserve count will not be incremented in free_huge_page. 365 365 * The reservation map will still indicate the reservation 366 366 * was consumed and possibly prevent later page allocation. 367 367 * This is better than leaking a global reservation. If no 368 - * reservation existed, it is still safe to clear PagePrivate 369 - * as no adjustments to reservation counts were made during 370 - * allocation. 368 + * reservation existed, it is still safe to clear 369 + * HPageRestoreReserve as no adjustments to reservation counts 370 + * were made during allocation. 371 371 * 372 372 * The reservation map for shared mappings indicates which 373 373 * pages have reservations. When a huge page is allocated 374 374 * for an address with a reservation, no change is made to 375 - * the reserve map. In this case PagePrivate will be set 376 - * to indicate that the global reservation count should be 375 + * the reserve map. In this case HPageRestoreReserve will be 376 + * set to indicate that the global reservation count should be 377 377 * incremented when the page is freed. This is the desired 378 378 * behavior. However, when a huge page is allocated for an 379 379 * address without a reservation a reservation entry is added 380 - * to the reservation map, and PagePrivate will not be set. 381 - * When the page is freed, the global reserve count will NOT 382 - * be incremented and it will appear as though we have leaked 383 - * reserved page. In this case, set PagePrivate so that the 384 - * global reserve count will be incremented to match the 385 - * reservation map entry which was created. 380 + * to the reservation map, and HPageRestoreReserve will not be 381 + * set. When the page is freed, the global reserve count will 382 + * NOT be incremented and it will appear as though we have 383 + * leaked reserved page. In this case, set HPageRestoreReserve 384 + * so that the global reserve count will be incremented to 385 + * match the reservation map entry which was created. 386 386 * 387 387 * Note that vm_alloc_shared is based on the flags of the vma 388 388 * for which the page was originally allocated. dst_vma could 389 389 * be different or NULL on error. 390 390 */ 391 391 if (vm_alloc_shared) 392 - SetPagePrivate(page); 392 + SetHPageRestoreReserve(page); 393 393 else 394 - ClearPagePrivate(page); 394 + ClearHPageRestoreReserve(page); 395 395 put_page(page); 396 396 } 397 397 BUG_ON(copied < 0);
+1 -1
tools/include/linux/bits.h
··· 22 22 #include <linux/build_bug.h> 23 23 #define GENMASK_INPUT_CHECK(h, l) \ 24 24 (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ 25 - __builtin_constant_p((l) > (h)), (l) > (h), 0))) 25 + __is_constexpr((l) > (h)), (l) > (h), 0))) 26 26 #else 27 27 /* 28 28 * BUILD_BUG_ON_ZERO is not available in h files included from asm files,
+8
tools/include/linux/const.h
··· 3 3 4 4 #include <vdso/const.h> 5 5 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 <Martin.Uecker@med.uni-goettingen.de> 10 + */ 11 + #define __is_constexpr(x) \ 12 + (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) 13 + 6 14 #endif /* _LINUX_CONST_H */
+3 -3
tools/testing/selftests/exec/Makefile
··· 28 28 cp $< $@ 29 29 chmod -x $@ 30 30 $(OUTPUT)/load_address_4096: load_address.c 31 - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie $< -o $@ 31 + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie -static $< -o $@ 32 32 $(OUTPUT)/load_address_2097152: load_address.c 33 - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie $< -o $@ 33 + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie -static $< -o $@ 34 34 $(OUTPUT)/load_address_16777216: load_address.c 35 - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie $< -o $@ 35 + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie -static $< -o $@