1. 21 7月, 2020 2 次提交
  2. 14 7月, 2020 2 次提交
    • N
      dma-direct: provide function to check physical memory area validity · 567f6a6e
      Nicolas Saenz Julienne 提交于
      dma_coherent_ok() checks if a physical memory area fits a device's DMA
      constraints.
      Signed-off-by: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      567f6a6e
    • M
      fuse: reject options on reconfigure via fsconfig(2) · b330966f
      Miklos Szeredi 提交于
      Previous patch changed handling of remount/reconfigure to ignore all
      options, including those that are unknown to the fuse kernel fs.  This was
      done for backward compatibility, but this likely only affects the old
      mount(2) API.
      
      The new fsconfig(2) based reconfiguration could possibly be improved.  This
      would make the new API less of a drop in replacement for the old, OTOH this
      is a good chance to get rid of some weirdnesses in the old API.
      
      Several other behaviors might make sense:
      
       1) unknown options are rejected, known options are ignored
      
       2) unknown options are rejected, known options are rejected if the value
       is changed, allowed otherwise
      
       3) all options are rejected
      
      Prior to the backward compatibility fix to ignore all options all known
      options were accepted (1), even if they change the value of a mount
      parameter; fuse_reconfigure() does not look at the config values set by
      fuse_parse_param().
      
      To fix that we'd need to verify that the value provided is the same as set
      in the initial configuration (2).  The major drawback is that this is much
      more complex than just rejecting all attempts at changing options (3);
      i.e. all options signify initial configuration values and don't make sense
      on reconfigure.
      
      This patch opts for (3) with the rationale that no mount options are
      reconfigurable in fuse.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      b330966f
  3. 10 7月, 2020 10 次提交
  4. 09 7月, 2020 4 次提交
    • D
      Input: elan_i2c - add more hardware ID for Lenovo laptops · a50ca295
      Dave Wang 提交于
      This adds more hardware IDs for Elan touchpads found in various Lenovo
      laptops.
      Signed-off-by: NDave Wang <dave.wang@emc.com.tw>
      Link: https://lore.kernel.org/r/000201d5a8bd$9fead3f0$dfc07bd0$@emc.com.tw
      Cc: stable@vger.kernel.org
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      a50ca295
    • K
      bpf: Check correct cred for CAP_SYSLOG in bpf_dump_raw_ok() · 63960260
      Kees Cook 提交于
      When evaluating access control over kallsyms visibility, credentials at
      open() time need to be used, not the "current" creds (though in BPF's
      case, this has likely always been the same). Plumb access to associated
      file->f_cred down through bpf_dump_raw_ok() and its callers now that
      kallsysm_show_value() has been refactored to take struct cred.
      
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: bpf@vger.kernel.org
      Cc: stable@vger.kernel.org
      Fixes: 7105e828 ("bpf: allow for correlation of maps and helpers in dump")
      Signed-off-by: NKees Cook <keescook@chromium.org>
      63960260
    • K
      kallsyms: Refactor kallsyms_show_value() to take cred · 16025184
      Kees Cook 提交于
      In order to perform future tests against the cred saved during open(),
      switch kallsyms_show_value() to operate on a cred, and have all current
      callers pass current_cred(). This makes it very obvious where callers
      are checking the wrong credential in their "read" contexts. These will
      be fixed in the coming patches.
      
      Additionally switch return value to bool, since it is always used as a
      direct permission check, not a 0-on-success, negative-on-error style
      function return.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NKees Cook <keescook@chromium.org>
      16025184
    • L
      Raise gcc version requirement to 4.9 · 6ec4476a
      Linus Torvalds 提交于
      I realize that we fairly recently raised it to 4.8, but the fact is, 4.9
      is a much better minimum version to target.
      
      We have a number of workarounds for actual bugs in pre-4.9 gcc versions
      (including things like internal compiler errors on ARM), but we also
      have some syntactic workarounds for lacking features.
      
      In particular, raising the minimum to 4.9 means that we can now just
      assume _Generic() exists, which is likely the much better replacement
      for a lot of very convoluted built-time magic with conditionals on
      sizeof and/or __builtin_choose_expr() with same_type() etc.
      
      Using _Generic also means that you will need to have a very recent
      version of 'sparse', but thats easy to build yourself, and much less of
      a hassle than some old gcc version can be.
      
      The latest (in a long string) of reasons for minimum compiler version
      upgrades was commit 5435f73d ("efi/x86: Fix build with gcc 4").
      
      Ard points out that RHEL 7 uses gcc-4.8, but the people who stay back on
      old RHEL versions persumably also don't build their own kernels anyway.
      And maybe they should cross-built or just have a little side affair with
      a newer compiler?
      Acked-by: NArd Biesheuvel <ardb@kernel.org>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6ec4476a
  5. 08 7月, 2020 6 次提交
    • P
      sched: Fix loadavg accounting race · dbfb089d
      Peter Zijlstra 提交于
      The recent commit:
      
        c6e7bd7a ("sched/core: Optimize ttwu() spinning on p->on_cpu")
      
      moved these lines in ttwu():
      
      	p->sched_contributes_to_load = !!task_contributes_to_load(p);
      	p->state = TASK_WAKING;
      
      up before:
      
      	smp_cond_load_acquire(&p->on_cpu, !VAL);
      
      into the 'p->on_rq == 0' block, with the thinking that once we hit
      schedule() the current task cannot change it's ->state anymore. And
      while this is true, it is both incorrect and flawed.
      
      It is incorrect in that we need at least an ACQUIRE on 'p->on_rq == 0'
      to avoid weak hardware from re-ordering things for us. This can fairly
      easily be achieved by relying on the control-dependency already in
      place.
      
      The second problem, which makes the flaw in the original argument, is
      that while schedule() will not change prev->state, it will read it a
      number of times (arguably too many times since it's marked volatile).
      The previous condition 'p->on_cpu == 0' was sufficient because that
      indicates schedule() has completed, and will no longer read
      prev->state. So now the trick is to make this same true for the (much)
      earlier 'prev->on_rq == 0' case.
      
      Furthermore, in order to make the ordering stick, the 'prev->on_rq = 0'
      assignment needs to he a RELEASE, but adding additional ordering to
      schedule() is an unwelcome proposition at the best of times, doubly so
      for mere accounting.
      
      Luckily we can push the prev->state load up before rq->lock, with the
      only caveat that we then have to re-read the state after. However, we
      know that if it changed, we no longer have to worry about the blocking
      path. This gives us the required ordering, if we block, we did the
      prev->state load before an (effective) smp_mb() and the p->on_rq store
      needs not change.
      
      With this we end up with the effective ordering:
      
      	LOAD p->state           LOAD-ACQUIRE p->on_rq == 0
      	MB
      	STORE p->on_rq, 0       STORE p->state, TASK_WAKING
      
      which ensures the TASK_WAKING store happens after the prev->state
      load, and all is well again.
      
      Fixes: c6e7bd7a ("sched/core: Optimize ttwu() spinning on p->on_cpu")
      Reported-by: NDave Jones <davej@codemonkey.org.uk>
      Reported-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Tested-by: NDave Jones <davej@codemonkey.org.uk>
      Tested-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Link: https://lkml.kernel.org/r/20200707102957.GN117543@hirez.programming.kicks-ass.net
      dbfb089d
    • C
      fs: remove __vfs_read · 775802c0
      Christoph Hellwig 提交于
      Fold it into the two callers.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      775802c0
    • C
      fs: add a __kernel_read helper · 61a707c5
      Christoph Hellwig 提交于
      This is the counterpart to __kernel_write, and skip the rw_verify_area
      call compared to kernel_read.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      61a707c5
    • T
      vlan: consolidate VLAN parsing code and limit max parsing depth · 469acedd
      Toke Høiland-Jørgensen 提交于
      Toshiaki pointed out that we now have two very similar functions to extract
      the L3 protocol number in the presence of VLAN tags. And Daniel pointed out
      that the unbounded parsing loop makes it possible for maliciously crafted
      packets to loop through potentially hundreds of tags.
      
      Fix both of these issues by consolidating the two parsing functions and
      limiting the VLAN tag parsing to a max depth of 8 tags. As part of this,
      switch over __vlan_get_protocol() to use skb_header_pointer() instead of
      pskb_may_pull(), to avoid the possible side effects of the latter and keep
      the skb pointer 'const' through all the parsing functions.
      
      v2:
      - Use limit of 8 tags instead of 32 (matching XMIT_RECURSION_LIMIT)
      Reported-by: NToshiaki Makita <toshiaki.makita1@gmail.com>
      Reported-by: NDaniel Borkmann <daniel@iogearbox.net>
      Fixes: d7bf2ebe ("sched: consistently handle layer3 header accesses in the presence of VLANs")
      Signed-off-by: NToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      469acedd
    • A
      fs: Add IOCB_NOIO flag for generic_file_read_iter · 41da51bc
      Andreas Gruenbacher 提交于
      Add an IOCB_NOIO flag that indicates to generic_file_read_iter that it
      shouldn't trigger any filesystem I/O for the actual request or for
      readahead.  This allows to do tentative reads out of the page cache as
      some filesystems allow, and to take the appropriate locks and retry the
      reads only if the requested pages are not cached.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      41da51bc
    • C
      cgroup: fix cgroup_sk_alloc() for sk_clone_lock() · ad0f75e5
      Cong Wang 提交于
      When we clone a socket in sk_clone_lock(), its sk_cgrp_data is
      copied, so the cgroup refcnt must be taken too. And, unlike the
      sk_alloc() path, sock_update_netprioidx() is not called here.
      Therefore, it is safe and necessary to grab the cgroup refcnt
      even when cgroup_sk_alloc is disabled.
      
      sk_clone_lock() is in BH context anyway, the in_interrupt()
      would terminate this function if called there. And for sk_alloc()
      skcd->val is always zero. So it's safe to factor out the code
      to make it more readable.
      
      The global variable 'cgroup_sk_alloc_disabled' is used to determine
      whether to take these reference counts. It is impossible to make
      the reference counting correct unless we save this bit of information
      in skcd->val. So, add a new bit there to record whether the socket
      has already taken the reference counts. This obviously relies on
      kmalloc() to align cgroup pointers to at least 4 bytes,
      ARCH_KMALLOC_MINALIGN is certainly larger than that.
      
      This bug seems to be introduced since the beginning, commit
      d979a39d ("cgroup: duplicate cgroup reference when cloning sockets")
      tried to fix it but not compeletely. It seems not easy to trigger until
      the recent commit 090e28b2
      ("netprio_cgroup: Fix unlimited memory leak of v2 cgroups") was merged.
      
      Fixes: bd1060a1 ("sock, cgroup: add sock->sk_cgroup")
      Reported-by: NCameron Berkenpas <cam@neo-zeon.de>
      Reported-by: NPeter Geis <pgwipeout@gmail.com>
      Reported-by: NLu Fengqi <lufq.fnst@cn.fujitsu.com>
      Reported-by: NDaniël Sonck <dsonck92@gmail.com>
      Reported-by: NZhang Qiang <qiang.zhang@windriver.com>
      Tested-by: NCameron Berkenpas <cam@neo-zeon.de>
      Tested-by: NPeter Geis <pgwipeout@gmail.com>
      Tested-by: NThomas Lamprecht <t.lamprecht@proxmox.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Roman Gushchin <guro@fb.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ad0f75e5
  6. 06 7月, 2020 1 次提交
  7. 04 7月, 2020 1 次提交
    • T
      sched: consistently handle layer3 header accesses in the presence of VLANs · d7bf2ebe
      Toke Høiland-Jørgensen 提交于
      There are a couple of places in net/sched/ that check skb->protocol and act
      on the value there. However, in the presence of VLAN tags, the value stored
      in skb->protocol can be inconsistent based on whether VLAN acceleration is
      enabled. The commit quoted in the Fixes tag below fixed the users of
      skb->protocol to use a helper that will always see the VLAN ethertype.
      
      However, most of the callers don't actually handle the VLAN ethertype, but
      expect to find the IP header type in the protocol field. This means that
      things like changing the ECN field, or parsing diffserv values, stops
      working if there's a VLAN tag, or if there are multiple nested VLAN
      tags (QinQ).
      
      To fix this, change the helper to take an argument that indicates whether
      the caller wants to skip the VLAN tags or not. When skipping VLAN tags, we
      make sure to skip all of them, so behaviour is consistent even in QinQ
      mode.
      
      To make the helper usable from the ECN code, move it to if_vlan.h instead
      of pkt_sched.h.
      
      v3:
      - Remove empty lines
      - Move vlan variable definitions inside loop in skb_protocol()
      - Also use skb_protocol() helper in IP{,6}_ECN_decapsulate() and
        bpf_skb_ecn_set_ce()
      
      v2:
      - Use eth_type_vlan() helper in skb_protocol()
      - Also fix code that reads skb->protocol directly
      - Change a couple of 'if/else if' statements to switch constructs to avoid
        calling the helper twice
      Reported-by: NIlya Ponetayev <i.ponetaev@ndmsystems.com>
      Fixes: d8b9605d ("net: sched: fix skb->protocol use in case of accelerated vlan path")
      Signed-off-by: NToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d7bf2ebe
  8. 02 7月, 2020 2 次提交
  9. 01 7月, 2020 5 次提交
  10. 30 6月, 2020 1 次提交
  11. 29 6月, 2020 1 次提交
  12. 28 6月, 2020 2 次提交
  13. 27 6月, 2020 3 次提交