History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Overlapping header include additions in macsec.c A bug fix in 'net' overlapping with the removal of 'version' string in ena_netdev.c Overlapping test additions in selftests Makefile Overlapping PCI ID table adjustments in iwlwifi driver.

David S. Miller committed 6 years ago

Commit 9fb16952 parents 1f074e6 1b649e0416 files · +4242 −1919Browse files

Showing the changes to kernel (8 of 416 files). Show all

Unified · Split

8 files
  1. kernel/bpf/bpf_struct_ops.c +11 −3
  2. kernel/bpf/btf.c +1 −1
  3. kernel/bpf/cgroup.c +5 −2
  4. kernel/bpf/syscall.c +5 −0
  5. kernel/futex.c +55 −38
  6. kernel/notifier.c +1 −1
  7. kernel/sys.c +2 −0
  8. kernel/trace/bpf_trace.c +1 −1
kernel/bpf/bpf_struct_ops.c+11−3
@@ -490,13 +490,21 @@ static int bpf_struct_ops_map_delete_elem(struct bpf_map *map, void *key) · 489 unmodified lines
490 prev_state = cmpxchg(&st_map->kvalue.state,490 prev_state = cmpxchg(&st_map->kvalue.state,
491 BPF_STRUCT_OPS_STATE_INUSE,491 BPF_STRUCT_OPS_STATE_INUSE,
492 BPF_STRUCT_OPS_STATE_TOBEFREE);492 BPF_STRUCT_OPS_STATE_TOBEFREE);
493 if (prev_state == BPF_STRUCT_OPS_STATE_INUSE) {493 switch (prev_state) {
494 case BPF_STRUCT_OPS_STATE_INUSE:
494 st_map->st_ops->unreg(&st_map->kvalue.data);495 st_map->st_ops->unreg(&st_map->kvalue.data);
495 if (refcount_dec_and_test(&st_map->kvalue.refcnt))496 if (refcount_dec_and_test(&st_map->kvalue.refcnt))
496 bpf_map_put(map);497 bpf_map_put(map);
498 return 0;
499 case BPF_STRUCT_OPS_STATE_TOBEFREE:
500 return -EINPROGRESS;
501 case BPF_STRUCT_OPS_STATE_INIT:
502 return -ENOENT;
503 default:
504 WARN_ON_ONCE(1);
505 /* Should never happen. Treat it as not found. */
506 return -ENOENT;
497 }507 }
498
499 return 0;
500}508}
501 509
502static void bpf_struct_ops_map_seq_show_elem(struct bpf_map *map, void *key,510static void bpf_struct_ops_map_seq_show_elem(struct bpf_map *map, void *key,
kernel/bpf/btf.c+1−1
@@ -2418,7 +2418,7 @@ static int btf_enum_check_member(struct btf_verifier_env *env, · 2417 unmodified lines
2418 2418
2419 struct_size = struct_type->size;2419 struct_size = struct_type->size;
2420 bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off);2420 bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off);
2421 if (struct_size - bytes_offset < sizeof(int)) {2421 if (struct_size - bytes_offset < member_type->size) {
2422 btf_verifier_log_member(env, struct_type, member,2422 btf_verifier_log_member(env, struct_type, member,
2423 "Member exceeds struct_size");2423 "Member exceeds struct_size");
2424 return -EINVAL;2424 return -EINVAL;
kernel/bpf/cgroup.c+5−2
@@ -227,6 +227,9 @@ cleanup: · 226 unmodified lines
227 for (i = 0; i < NR; i++)227 for (i = 0; i < NR; i++)
228 bpf_prog_array_free(arrays[i]);228 bpf_prog_array_free(arrays[i]);
229 229
230 for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p))
231 cgroup_bpf_put(p);
232
230 percpu_ref_exit(&cgrp->bpf.refcnt);233 percpu_ref_exit(&cgrp->bpf.refcnt);
231 234
232 return -ENOMEM;235 return -ENOMEM;
@@ -302,8 +305,8 @@ int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, · 69 unmodified lines
302 u32 saved_flags = (flags & (BPF_F_ALLOW_OVERRIDE | BPF_F_ALLOW_MULTI));305 u32 saved_flags = (flags & (BPF_F_ALLOW_OVERRIDE | BPF_F_ALLOW_MULTI));
303 struct list_head *progs = &cgrp->bpf.progs[type];306 struct list_head *progs = &cgrp->bpf.progs[type];
304 struct bpf_prog *old_prog = NULL;307 struct bpf_prog *old_prog = NULL;
305 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE],308 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {};
306 *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {NULL};309 struct bpf_cgroup_storage *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {};
307 struct bpf_prog_list *pl, *replace_pl = NULL;310 struct bpf_prog_list *pl, *replace_pl = NULL;
308 enum bpf_cgroup_storage_type stype;311 enum bpf_cgroup_storage_type stype;
309 int err;312 int err;
kernel/bpf/syscall.c+5−0
@@ -1514,6 +1514,11 @@ static int map_freeze(const union bpf_attr *attr) · 1513 unmodified lines
1514 if (IS_ERR(map))1514 if (IS_ERR(map))
1515 return PTR_ERR(map);1515 return PTR_ERR(map);
1516 1516
1517 if (map->map_type == BPF_MAP_TYPE_STRUCT_OPS) {
1518 fdput(f);
1519 return -ENOTSUPP;
1520 }
1521
1517 mutex_lock(&map->freeze_mutex);1522 mutex_lock(&map->freeze_mutex);
1518 1523
1519 if (map->writecnt) {1524 if (map->writecnt) {
kernel/futex.c+55−38
@@ -385,9 +385,9 @@ static inline int hb_waiters_pending(struct futex_hash_bucket *hb) · 384 unmodified lines
385 */385 */
386static struct futex_hash_bucket *hash_futex(union futex_key *key)386static struct futex_hash_bucket *hash_futex(union futex_key *key)
387{387{
388 u32 hash = jhash2((u32*)&key->both.word,388 u32 hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / 4,
389 (sizeof(key->both.word)+sizeof(key->both.ptr))/4,
390 key->both.offset);389 key->both.offset);
390
391 return &futex_queues[hash & (futex_hashsize - 1)];391 return &futex_queues[hash & (futex_hashsize - 1)];
392}392}
393 393
@@ -429,7 +429,7 @@ static void get_futex_key_refs(union futex_key *key) · 35 unmodified lines
429 429
430 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {430 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {
431 case FUT_OFF_INODE:431 case FUT_OFF_INODE:
432 ihold(key->shared.inode); /* implies smp_mb(); (B) */432 smp_mb(); /* explicit smp_mb(); (B) */
433 break;433 break;
434 case FUT_OFF_MMSHARED:434 case FUT_OFF_MMSHARED:
435 futex_get_mm(key); /* implies smp_mb(); (B) */435 futex_get_mm(key); /* implies smp_mb(); (B) */
@@ -463,7 +463,6 @@ static void drop_futex_key_refs(union futex_key *key) · 27 unmodified lines
463 463
464 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {464 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {
465 case FUT_OFF_INODE:465 case FUT_OFF_INODE:
466 iput(key->shared.inode);
467 break;466 break;
468 case FUT_OFF_MMSHARED:467 case FUT_OFF_MMSHARED:
469 mmdrop(key->private.mm);468 mmdrop(key->private.mm);
@@ -505,6 +504,46 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout, · 35 unmodified lines
505 return timeout;504 return timeout;
506}505}
507 506
507/*
508 * Generate a machine wide unique identifier for this inode.
509 *
510 * This relies on u64 not wrapping in the life-time of the machine; which with
511 * 1ns resolution means almost 585 years.
512 *
513 * This further relies on the fact that a well formed program will not unmap
514 * the file while it has a (shared) futex waiting on it. This mapping will have
515 * a file reference which pins the mount and inode.
516 *
517 * If for some reason an inode gets evicted and read back in again, it will get
518 * a new sequence number and will _NOT_ match, even though it is the exact same
519 * file.
520 *
521 * It is important that match_futex() will never have a false-positive, esp.
522 * for PI futexes that can mess up the state. The above argues that false-negatives
523 * are only possible for malformed programs.
524 */
525static u64 get_inode_sequence_number(struct inode *inode)
526{
527 static atomic64_t i_seq;
528 u64 old;
529
530 /* Does the inode already have a sequence number? */
531 old = atomic64_read(&inode->i_sequence);
532 if (likely(old))
533 return old;
534
535 for (;;) {
536 u64 new = atomic64_add_return(1, &i_seq);
537 if (WARN_ON_ONCE(!new))
538 continue;
539
540 old = atomic64_cmpxchg_relaxed(&inode->i_sequence, 0, new);
541 if (old)
542 return old;
543 return new;
544 }
545}
546
508/**547/**
509 * get_futex_key() - Get parameters which are the keys for a futex548 * get_futex_key() - Get parameters which are the keys for a futex
510 * @uaddr: virtual address of the futex549 * @uaddr: virtual address of the futex
@@ -517,9 +556,15 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout, · 6 unmodified lines
517 *556 *
518 * The key words are stored in @key on success.557 * The key words are stored in @key on success.
519 *558 *
520 * For shared mappings, it's (page->index, file_inode(vma->vm_file),559 * For shared mappings (when @fshared), the key is:
521 * offset_within_page). For private mappings, it's (uaddr, current->mm).560 * ( inode->i_sequence, page->index, offset_within_page )
522 * We can usually work out the index without swapping in the page.561 * [ also see get_inode_sequence_number() ]
562 *
563 * For private mappings (or when !@fshared), the key is:
564 * ( current->mm, address, 0 )
565 *
566 * This allows (cross process, where applicable) identification of the futex
567 * without keeping the page pinned for the duration of the FUTEX_WAIT.
523 *568 *
524 * lock_page() might sleep, the caller should not hold a spinlock.569 * lock_page() might sleep, the caller should not hold a spinlock.
525 */570 */
@@ -659,8 +704,6 @@ again: · 133 unmodified lines
659 key->private.mm = mm;704 key->private.mm = mm;
660 key->private.address = address;705 key->private.address = address;
661 706
662 get_futex_key_refs(key); /* implies smp_mb(); (B) */
663
664 } else {707 } else {
665 struct inode *inode;708 struct inode *inode;
666 709
@@ -692,40 +735,14 @@ again: · 25 unmodified lines
692 goto again;735 goto again;
693 }736 }
694 737
695 /*
696 * Take a reference unless it is about to be freed. Previously
697 * this reference was taken by ihold under the page lock
698 * pinning the inode in place so i_lock was unnecessary. The
699 * only way for this check to fail is if the inode was
700 * truncated in parallel which is almost certainly an
701 * application bug. In such a case, just retry.
702 *
703 * We are not calling into get_futex_key_refs() in file-backed
704 * cases, therefore a successful atomic_inc return below will
705 * guarantee that get_futex_key() will still imply smp_mb(); (B).
706 */
707 if (!atomic_inc_not_zero(&inode->i_count)) {
708 rcu_read_unlock();
709 put_page(page);
710
711 goto again;
712 }
713
714 /* Should be impossible but lets be paranoid for now */
715 if (WARN_ON_ONCE(inode->i_mapping != mapping)) {
716 err = -EFAULT;
717 rcu_read_unlock();
718 iput(inode);
719
720 goto out;
721 }
722
723 key->both.offset |= FUT_OFF_INODE; /* inode-based key */738 key->both.offset |= FUT_OFF_INODE; /* inode-based key */
724 key->shared.inode = inode;739 key->shared.i_seq = get_inode_sequence_number(inode);
725 key->shared.pgoff = basepage_index(tail);740 key->shared.pgoff = basepage_index(tail);
726 rcu_read_unlock();741 rcu_read_unlock();
727 }742 }
728 743
744 get_futex_key_refs(key); /* implies smp_mb(); (B) */
745
729out:746out:
730 put_page(page);747 put_page(page);
731 return err;748 return err;
kernel/notifier.c+1−1
@@ -519,7 +519,7 @@ NOKPROBE_SYMBOL(notify_die); · 518 unmodified lines
519 519
520int register_die_notifier(struct notifier_block *nb)520int register_die_notifier(struct notifier_block *nb)
521{521{
522 vmalloc_sync_all();522 vmalloc_sync_mappings();
523 return atomic_notifier_chain_register(&die_chain, nb);523 return atomic_notifier_chain_register(&die_chain, nb);
524}524}
525EXPORT_SYMBOL_GPL(register_die_notifier);525EXPORT_SYMBOL_GPL(register_die_notifier);
kernel/sys.c+2−0
@@ -47,6 +47,7 @@ · 46 unmodified lines
47#include <linux/syscalls.h>47#include <linux/syscalls.h>
48#include <linux/kprobes.h>48#include <linux/kprobes.h>
49#include <linux/user_namespace.h>49#include <linux/user_namespace.h>
50#include <linux/time_namespace.h>
50#include <linux/binfmts.h>51#include <linux/binfmts.h>
51 52
52#include <linux/sched.h>53#include <linux/sched.h>
@@ -2546,6 +2547,7 @@ static int do_sysinfo(struct sysinfo *info) · 2493 unmodified lines
2546 memset(info, 0, sizeof(struct sysinfo));2547 memset(info, 0, sizeof(struct sysinfo));
2547 2548
2548 ktime_get_boottime_ts64(&tp);2549 ktime_get_boottime_ts64(&tp);
2550 timens_add_boottime(&tp);
2549 info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);2551 info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
2550 2552
2551 get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);2553 get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
kernel/trace/bpf_trace.c+1−1
@@ -730,7 +730,7 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type) · 729 unmodified lines
730 if (unlikely(!nmi_uaccess_okay()))730 if (unlikely(!nmi_uaccess_okay()))
731 return -EPERM;731 return -EPERM;
732 732
733 if (in_nmi()) {733 if (irqs_disabled()) {
734 /* Do an early check on signal validity. Otherwise,734 /* Do an early check on signal validity. Otherwise,
735 * the error is lost in deferred irq_work.735 * the error is lost in deferred irq_work.
736 */736 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t