1. 10 5月, 2023 1 次提交
  2. 13 2月, 2023 1 次提交
  3. 25 11月, 2022 2 次提交
  4. 22 11月, 2022 1 次提交
    • T
      xfrm: Fix oops in __xfrm_state_delete() · b97df039
      Thomas Jarosch 提交于
      Kernel 5.14 added a new "byseq" index to speed
      up xfrm_state lookups by sequence number in commit
      fe9f1d87 ("xfrm: add state hashtable keyed by seq")
      
      While the patch was thorough, the function pfkey_send_new_mapping()
      in net/af_key.c also modifies x->km.seq and never added
      the current xfrm_state to the "byseq" index.
      
      This leads to the following kernel Ooops:
          BUG: kernel NULL pointer dereference, address: 0000000000000000
          ..
          RIP: 0010:__xfrm_state_delete+0xc9/0x1c0
          ..
          Call Trace:
          <TASK>
          xfrm_state_delete+0x1e/0x40
          xfrm_del_sa+0xb0/0x110 [xfrm_user]
          xfrm_user_rcv_msg+0x12d/0x270 [xfrm_user]
          ? remove_entity_load_avg+0x8a/0xa0
          ? copy_to_user_state_extra+0x580/0x580 [xfrm_user]
          netlink_rcv_skb+0x51/0x100
          xfrm_netlink_rcv+0x30/0x50 [xfrm_user]
          netlink_unicast+0x1a6/0x270
          netlink_sendmsg+0x22a/0x480
          __sys_sendto+0x1a6/0x1c0
          ? __audit_syscall_entry+0xd8/0x130
          ? __audit_syscall_exit+0x249/0x2b0
          __x64_sys_sendto+0x23/0x30
          do_syscall_64+0x3a/0x90
          entry_SYSCALL_64_after_hwframe+0x61/0xcb
      
      Exact location of the crash in __xfrm_state_delete():
          if (x->km.seq)
              hlist_del_rcu(&x->byseq);
      
      The hlist_node "byseq" was never populated.
      
      The bug only triggers if a new NAT traversal mapping (changed IP or port)
      is detected in esp_input_done2() / esp6_input_done2(), which in turn
      indirectly calls pfkey_send_new_mapping() *if* the kernel is compiled
      with CONFIG_NET_KEY and "af_key" is active.
      
      The PF_KEYv2 message SADB_X_NAT_T_NEW_MAPPING is not part of RFC 2367.
      Various implementations have been examined how they handle
      the "sadb_msg_seq" header field:
      
      - racoon (Android): does not process SADB_X_NAT_T_NEW_MAPPING
      - strongswan: does not care about sadb_msg_seq
      - openswan: does not care about sadb_msg_seq
      
      There is no standard how PF_KEYv2 sadb_msg_seq should be populated
      for SADB_X_NAT_T_NEW_MAPPING and it's not used in popular
      implementations either. Herbert Xu suggested we should just
      use the current km.seq value as is. This fixes the root cause
      of the oops since we no longer modify km.seq itself.
      
      The update of "km.seq" looks like a copy'n'paste error
      from pfkey_send_acquire(). SADB_ACQUIRE must indeed assign a unique km.seq
      number according to RFC 2367. It has been verified that code paths
      involving pfkey_send_acquire() don't cause the same Oops.
      
      PF_KEYv2 SADB_X_NAT_T_NEW_MAPPING support was originally added here:
          https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
      
          commit cbc3488685b20e7b2a98ad387a1a816aada569d8
          Author:     Derek Atkins <derek@ihtfp.com>
          AuthorDate: Wed Apr 2 13:21:02 2003 -0800
      
              [IPSEC]: Implement UDP Encapsulation framework.
      
              In particular, implement ESPinUDP encapsulation for IPsec
              Nat Traversal.
      
      A note on triggering the bug: I was not able to trigger it using VMs.
      There is one VPN using a high latency link on our production VPN server
      that triggered it like once a day though.
      
      Link: https://github.com/strongswan/strongswan/issues/992
      Link: https://lore.kernel.org/netdev/00959f33ee52c4b3b0084d42c430418e502db554.1652340703.git.antony.antony@secunet.com/T/
      Link: https://lore.kernel.org/netdev/20221027142455.3975224-1-chenzhihao@meizu.com/T/
      
      Fixes: fe9f1d87 ("xfrm: add state hashtable keyed by seq")
      Reported-by: NRoth Mark <rothm@mail.com>
      Reported-by: NZhihao Chen <chenzhihao@meizu.com>
      Tested-by: NRoth Mark <rothm@mail.com>
      Signed-off-by: NThomas Jarosch <thomas.jarosch@intra2net.com>
      Acked-by: NAntony Antony <antony.antony@secunet.com>
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      b97df039
  5. 27 10月, 2022 1 次提交
  6. 05 8月, 2022 1 次提交
  7. 24 6月, 2022 1 次提交
  8. 25 5月, 2022 1 次提交
    • M
      Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process" · 9c90c9b3
      Michal Kubecek 提交于
      This reverts commit 4dc2a5a8.
      
      A non-zero return value from pfkey_broadcast() does not necessarily mean
      an error occurred as this function returns -ESRCH when no registered
      listener received the message. In particular, a call with
      BROADCAST_PROMISC_ONLY flag and null one_sk argument can never return
      zero so that this commit in fact prevents processing any PF_KEY message.
      One visible effect is that racoon daemon fails to find encryption
      algorithms like aes and refuses to start.
      
      Excluding -ESRCH return value would fix this but it's not obvious that
      we really want to bail out here and most other callers of
      pfkey_broadcast() also ignore the return value. Also, as pointed out by
      Steffen Klassert, PF_KEY is kind of deprecated and newer userspace code
      should use netlink instead so that we should only disturb the code for
      really important fixes.
      
      v2: add a comment explaining why is the return value ignored
      Signed-off-by: NMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      9c90c9b3
  9. 18 5月, 2022 2 次提交
  10. 29 4月, 2022 1 次提交
  11. 06 4月, 2022 1 次提交
    • O
      net: remove noblock parameter from skb_recv_datagram() · f4b41f06
      Oliver Hartkopp 提交于
      skb_recv_datagram() has two parameters 'flags' and 'noblock' that are
      merged inside skb_recv_datagram() by 'flags | (noblock ? MSG_DONTWAIT : 0)'
      
      As 'flags' may contain MSG_DONTWAIT as value most callers split the 'flags'
      into 'flags' and 'noblock' with finally obsolete bit operations like this:
      
      skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &rc);
      
      And this is not even done consistently with the 'flags' parameter.
      
      This patch removes the obsolete and costly splitting into two parameters
      and only performs bit operations when really needed on the caller side.
      
      One missing conversion thankfully reported by kernel test robot. I missed
      to enable kunit tests to build the mctp code.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f4b41f06
  12. 10 3月, 2022 1 次提交
  13. 26 1月, 2022 1 次提交
    • Y
      xfrm: Check if_id in xfrm_migrate · c1aca308
      Yan Yan 提交于
      This patch enables distinguishing SAs and SPs based on if_id during
      the xfrm_migrate flow. This ensures support for xfrm interfaces
      throughout the SA/SP lifecycle.
      
      When there are multiple existing SPs with the same direction,
      the same xfrm_selector and different endpoint addresses,
      xfrm_migrate might fail with ENODATA.
      
      Specifically, the code path for performing xfrm_migrate is:
        Stage 1: find policy to migrate with
          xfrm_migrate_policy_find(sel, dir, type, net)
        Stage 2: find and update state(s) with
          xfrm_migrate_state_find(mp, net)
        Stage 3: update endpoint address(es) of template(s) with
          xfrm_policy_migrate(pol, m, num_migrate)
      
      Currently "Stage 1" always returns the first xfrm_policy that
      matches, and "Stage 3" looks for the xfrm_tmpl that matches the
      old endpoint address. Thus if there are multiple xfrm_policy
      with same selector, direction, type and net, "Stage 1" might
      rertun a wrong xfrm_policy and "Stage 3" will fail with ENODATA
      because it cannot find a xfrm_tmpl with the matching endpoint
      address.
      
      The fix is to allow userspace to pass an if_id and add if_id
      to the matching rule in Stage 1 and Stage 2 since if_id is a
      unique ID for xfrm_policy and xfrm_state. For compatibility,
      if_id will only be checked if the attribute is set.
      
      Tested with additions to Android's kernel unit test suite:
      https://android-review.googlesource.com/c/kernel/tests/+/1668886Signed-off-by: NYan Yan <evitayan@google.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      c1aca308
  14. 26 5月, 2021 1 次提交
  15. 04 1月, 2021 1 次提交
    • C
      af_key: relax availability checks for skb size calculation · afbc293a
      Cong Wang 提交于
      xfrm_probe_algs() probes kernel crypto modules and changes the
      availability of struct xfrm_algo_desc. But there is a small window
      where ealg->available and aalg->available get changed between
      count_ah_combs()/count_esp_combs() and dump_ah_combs()/dump_esp_combs(),
      in this case we may allocate a smaller skb but later put a larger
      amount of data and trigger the panic in skb_put().
      
      Fix this by relaxing the checks when counting the size, that is,
      skipping the test of ->available. We may waste some memory for a few
      of sizeof(struct sadb_comb), but it is still much better than a panic.
      
      Reported-by: syzbot+b2bf2652983d23734c5c@syzkaller.appspotmail.com
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NCong Wang <cong.wang@bytedance.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      afbc293a
  16. 22 7月, 2020 1 次提交
    • M
      af_key: pfkey_dump needs parameter validation · 37bd2242
      Mark Salyzyn 提交于
      In pfkey_dump() dplen and splen can both be specified to access the
      xfrm_address_t structure out of bounds in__xfrm_state_filter_match()
      when it calls addr_match() with the indexes.  Return EINVAL if either
      are out of range.
      Signed-off-by: NMark Salyzyn <salyzyn@android.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: kernel-team@android.com
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      37bd2242
  17. 20 7月, 2020 1 次提交
  18. 24 6月, 2020 1 次提交
    • X
      xfrm: policy: match with both mark and mask on user interfaces · 4f47e8ab
      Xin Long 提交于
      In commit ed17b8d3 ("xfrm: fix a warning in xfrm_policy_insert_list"),
      it would take 'priority' to make a policy unique, and allow duplicated
      policies with different 'priority' to be added, which is not expected
      by userland, as Tobias reported in strongswan.
      
      To fix this duplicated policies issue, and also fix the issue in
      commit ed17b8d3 ("xfrm: fix a warning in xfrm_policy_insert_list"),
      when doing add/del/get/update on user interfaces, this patch is to change
      to look up a policy with both mark and mask by doing:
      
        mark.v == pol->mark.v && mark.m == pol->mark.m
      
      and leave the check:
      
        (mark & pol->mark.m) == pol->mark.v
      
      for tx/rx path only.
      
      As the userland expects an exact mark and mask match to manage policies.
      
      v1->v2:
        - make xfrm_policy_mark_match inline and fix the changelog as
          Tobias suggested.
      
      Fixes: 295fae56 ("xfrm: Allow user space manipulation of SPD mark")
      Fixes: ed17b8d3 ("xfrm: fix a warning in xfrm_policy_insert_list")
      Reported-by: NTobias Brunner <tobias@strongswan.org>
      Tested-by: NTobias Brunner <tobias@strongswan.org>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      4f47e8ab
  19. 10 6月, 2019 1 次提交
  20. 31 5月, 2019 1 次提交
  21. 28 5月, 2019 1 次提交
  22. 26 3月, 2019 1 次提交
    • C
      xfrm: clean up xfrm protocol checks · dbb2483b
      Cong Wang 提交于
      In commit 6a53b759 ("xfrm: check id proto in validate_tmpl()")
      I introduced a check for xfrm protocol, but according to Herbert
      IPSEC_PROTO_ANY should only be used as a wildcard for lookup, so
      it should be removed from validate_tmpl().
      
      And, IPSEC_PROTO_ANY is expected to only match 3 IPSec-specific
      protocols, this is why xfrm_state_flush() could still miss
      IPPROTO_ROUTING, which leads that those entries are left in
      net->xfrm.state_all before exit net. Fix this by replacing
      IPSEC_PROTO_ANY with zero.
      
      This patch also extracts the check from validate_tmpl() to
      xfrm_id_proto_valid() and uses it in parse_ipsecrequest().
      With this, no other protocols should be added into xfrm.
      
      Fixes: 6a53b759 ("xfrm: check id proto in validate_tmpl()")
      Reported-by: syzbot+0bf0519d6e0de15914fe@syzkaller.appspotmail.com
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      dbb2483b
  23. 12 2月, 2019 1 次提交
    • S
      af_key: unconditionally clone on broadcast · fc2d5cfd
      Sean Tranchetti 提交于
      Attempting to avoid cloning the skb when broadcasting by inflating
      the refcount with sock_hold/sock_put while under RCU lock is dangerous
      and violates RCU principles. It leads to subtle race conditions when
      attempting to free the SKB, as we may reference sockets that have
      already been freed by the stack.
      
      Unable to handle kernel paging request at virtual address 6b6b6b6b6b6c4b
      [006b6b6b6b6b6c4b] address between user and kernel address ranges
      Internal error: Oops: 96000004 [#1] PREEMPT SMP
      task: fffffff78f65b380 task.stack: ffffff8049a88000
      pc : sock_rfree+0x38/0x6c
      lr : skb_release_head_state+0x6c/0xcc
      Process repro (pid: 7117, stack limit = 0xffffff8049a88000)
      Call trace:
      	sock_rfree+0x38/0x6c
      	skb_release_head_state+0x6c/0xcc
      	skb_release_all+0x1c/0x38
      	__kfree_skb+0x1c/0x30
      	kfree_skb+0xd0/0xf4
      	pfkey_broadcast+0x14c/0x18c
      	pfkey_sendmsg+0x1d8/0x408
      	sock_sendmsg+0x44/0x60
      	___sys_sendmsg+0x1d0/0x2a8
      	__sys_sendmsg+0x64/0xb4
      	SyS_sendmsg+0x34/0x4c
      	el0_svc_naked+0x34/0x38
      Kernel panic - not syncing: Fatal exception
      Suggested-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NSean Tranchetti <stranche@codeaurora.org>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      fc2d5cfd
  24. 05 2月, 2019 1 次提交
    • C
      xfrm: destroy xfrm_state synchronously on net exit path · f75a2804
      Cong Wang 提交于
      xfrm_state_put() moves struct xfrm_state to the GC list
      and schedules the GC work to clean it up. On net exit call
      path, xfrm_state_flush() is called to clean up and
      xfrm_flush_gc() is called to wait for the GC work to complete
      before exit.
      
      However, this doesn't work because one of the ->destructor(),
      ipcomp_destroy(), schedules the same GC work again inside
      the GC work. It is hard to wait for such a nested async
      callback. This is also why syzbot still reports the following
      warning:
      
       WARNING: CPU: 1 PID: 33 at net/ipv6/xfrm6_tunnel.c:351 xfrm6_tunnel_net_exit+0x2cb/0x500 net/ipv6/xfrm6_tunnel.c:351
       ...
        ops_exit_list.isra.0+0xb0/0x160 net/core/net_namespace.c:153
        cleanup_net+0x51d/0xb10 net/core/net_namespace.c:551
        process_one_work+0xd0c/0x1ce0 kernel/workqueue.c:2153
        worker_thread+0x143/0x14a0 kernel/workqueue.c:2296
        kthread+0x357/0x430 kernel/kthread.c:246
        ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
      
      In fact, it is perfectly fine to bypass GC and destroy xfrm_state
      synchronously on net exit call path, because it is in process context
      and doesn't need a work struct to do any blocking work.
      
      This patch introduces xfrm_state_put_sync() which simply bypasses
      GC, and lets its callers to decide whether to use this synchronous
      version. On net exit path, xfrm_state_fini() and
      xfrm6_tunnel_net_exit() use it. And, as ipcomp_destroy() itself is
      blocking, it can use xfrm_state_put_sync() directly too.
      
      Also rename xfrm_state_gc_destroy() to ___xfrm_state_destroy() to
      reflect this change.
      
      Fixes: b48c05ab ("xfrm: Fix warning in xfrm6_tunnel_net_exit.")
      Reported-and-tested-by: syzbot+e9aebef558e3ed673934@syzkaller.appspotmail.com
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      f75a2804
  25. 16 11月, 2018 1 次提交
  26. 29 6月, 2018 1 次提交
    • L
      Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL · a11e1d43
      Linus Torvalds 提交于
      The poll() changes were not well thought out, and completely
      unexplained.  They also caused a huge performance regression, because
      "->poll()" was no longer a trivial file operation that just called down
      to the underlying file operations, but instead did at least two indirect
      calls.
      
      Indirect calls are sadly slow now with the Spectre mitigation, but the
      performance problem could at least be largely mitigated by changing the
      "->get_poll_head()" operation to just have a per-file-descriptor pointer
      to the poll head instead.  That gets rid of one of the new indirections.
      
      But that doesn't fix the new complexity that is completely unwarranted
      for the regular case.  The (undocumented) reason for the poll() changes
      was some alleged AIO poll race fixing, but we don't make the common case
      slower and more complex for some uncommon special case, so this all
      really needs way more explanations and most likely a fundamental
      redesign.
      
      [ This revert is a revert of about 30 different commits, not reverted
        individually because that would just be unnecessarily messy  - Linus ]
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a11e1d43
  27. 23 6月, 2018 1 次提交
  28. 26 5月, 2018 1 次提交
  29. 16 5月, 2018 1 次提交
  30. 09 4月, 2018 1 次提交
    • K
      af_key: Always verify length of provided sadb_key · 4b66af2d
      Kevin Easton 提交于
      Key extensions (struct sadb_key) include a user-specified number of key
      bits.  The kernel uses that number to determine how much key data to copy
      out of the message in pfkey_msg2xfrm_state().
      
      The length of the sadb_key message must be verified to be long enough,
      even in the case of SADB_X_AALG_NULL.  Furthermore, the sadb_key_len value
      must be long enough to include both the key data and the struct sadb_key
      itself.
      
      Introduce a helper function verify_key_len(), and call it from
      parse_exthdrs() where other exthdr types are similarly checked for
      correctness.
      Signed-off-by: NKevin Easton <kevin@guarana.org>
      Reported-by: syzbot+5022a34ca5a3d49b84223653fab632dfb7b4cf37@syzkaller.appspotmail.com
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      4b66af2d
  31. 28 3月, 2018 1 次提交
  32. 28 2月, 2018 1 次提交
  33. 10 1月, 2018 1 次提交
  34. 30 12月, 2017 2 次提交
    • E
      af_key: fix buffer overread in parse_exthdrs() · 4e765b49
      Eric Biggers 提交于
      If a message sent to a PF_KEY socket ended with an incomplete extension
      header (fewer than 4 bytes remaining), then parse_exthdrs() read past
      the end of the message, into uninitialized memory.  Fix it by returning
      -EINVAL in this case.
      
      Reproducer:
      
      	#include <linux/pfkeyv2.h>
      	#include <sys/socket.h>
      	#include <unistd.h>
      
      	int main()
      	{
      		int sock = socket(PF_KEY, SOCK_RAW, PF_KEY_V2);
      		char buf[17] = { 0 };
      		struct sadb_msg *msg = (void *)buf;
      
      		msg->sadb_msg_version = PF_KEY_V2;
      		msg->sadb_msg_type = SADB_DELETE;
      		msg->sadb_msg_len = 2;
      
      		write(sock, buf, 17);
      	}
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      4e765b49
    • E
      af_key: fix buffer overread in verify_address_len() · 06b335cb
      Eric Biggers 提交于
      If a message sent to a PF_KEY socket ended with one of the extensions
      that takes a 'struct sadb_address' but there were not enough bytes
      remaining in the message for the ->sa_family member of the 'struct
      sockaddr' which is supposed to follow, then verify_address_len() read
      past the end of the message, into uninitialized memory.  Fix it by
      returning -EINVAL in this case.
      
      This bug was found using syzkaller with KMSAN.
      
      Reproducer:
      
      	#include <linux/pfkeyv2.h>
      	#include <sys/socket.h>
      	#include <unistd.h>
      
      	int main()
      	{
      		int sock = socket(PF_KEY, SOCK_RAW, PF_KEY_V2);
      		char buf[24] = { 0 };
      		struct sadb_msg *msg = (void *)buf;
      		struct sadb_address *addr = (void *)(msg + 1);
      
      		msg->sadb_msg_version = PF_KEY_V2;
      		msg->sadb_msg_type = SADB_DELETE;
      		msg->sadb_msg_len = 3;
      		addr->sadb_address_len = 1;
      		addr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC;
      
      		write(sock, buf, 24);
      	}
      Reported-by: NAlexander Potapenko <glider@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      06b335cb
  35. 14 11月, 2017 1 次提交
  36. 15 8月, 2017 1 次提交
    • E
      af_key: do not use GFP_KERNEL in atomic contexts · 36f41f8f
      Eric Dumazet 提交于
      pfkey_broadcast() might be called from non process contexts,
      we can not use GFP_KERNEL in these cases [1].
      
      This patch partially reverts commit ba51b6be ("net: Fix RCU splat in
      af_key"), only keeping the GFP_ATOMIC forcing under rcu_read_lock()
      section.
      
      [1] : syzkaller reported :
      
      in_atomic(): 1, irqs_disabled(): 0, pid: 2932, name: syzkaller183439
      3 locks held by syzkaller183439/2932:
       #0:  (&net->xfrm.xfrm_cfg_mutex){+.+.+.}, at: [<ffffffff83b43888>] pfkey_sendmsg+0x4c8/0x9f0 net/key/af_key.c:3649
       #1:  (&pfk->dump_lock){+.+.+.}, at: [<ffffffff83b467f6>] pfkey_do_dump+0x76/0x3f0 net/key/af_key.c:293
       #2:  (&(&net->xfrm.xfrm_policy_lock)->rlock){+...+.}, at: [<ffffffff83957632>] spin_lock_bh include/linux/spinlock.h:304 [inline]
       #2:  (&(&net->xfrm.xfrm_policy_lock)->rlock){+...+.}, at: [<ffffffff83957632>] xfrm_policy_walk+0x192/0xa30 net/xfrm/xfrm_policy.c:1028
      CPU: 0 PID: 2932 Comm: syzkaller183439 Not tainted 4.13.0-rc4+ #24
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:16 [inline]
       dump_stack+0x194/0x257 lib/dump_stack.c:52
       ___might_sleep+0x2b2/0x470 kernel/sched/core.c:5994
       __might_sleep+0x95/0x190 kernel/sched/core.c:5947
       slab_pre_alloc_hook mm/slab.h:416 [inline]
       slab_alloc mm/slab.c:3383 [inline]
       kmem_cache_alloc+0x24b/0x6e0 mm/slab.c:3559
       skb_clone+0x1a0/0x400 net/core/skbuff.c:1037
       pfkey_broadcast_one+0x4b2/0x6f0 net/key/af_key.c:207
       pfkey_broadcast+0x4ba/0x770 net/key/af_key.c:281
       dump_sp+0x3d6/0x500 net/key/af_key.c:2685
       xfrm_policy_walk+0x2f1/0xa30 net/xfrm/xfrm_policy.c:1042
       pfkey_dump_sp+0x42/0x50 net/key/af_key.c:2695
       pfkey_do_dump+0xaa/0x3f0 net/key/af_key.c:299
       pfkey_spddump+0x1a0/0x210 net/key/af_key.c:2722
       pfkey_process+0x606/0x710 net/key/af_key.c:2814
       pfkey_sendmsg+0x4d6/0x9f0 net/key/af_key.c:3650
      sock_sendmsg_nosec net/socket.c:633 [inline]
       sock_sendmsg+0xca/0x110 net/socket.c:643
       ___sys_sendmsg+0x755/0x890 net/socket.c:2035
       __sys_sendmsg+0xe5/0x210 net/socket.c:2069
       SYSC_sendmsg net/socket.c:2080 [inline]
       SyS_sendmsg+0x2d/0x50 net/socket.c:2076
       entry_SYSCALL_64_fastpath+0x1f/0xbe
      RIP: 0033:0x445d79
      RSP: 002b:00007f32447c1dc8 EFLAGS: 00000202 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000445d79
      RDX: 0000000000000000 RSI: 000000002023dfc8 RDI: 0000000000000008
      RBP: 0000000000000086 R08: 00007f32447c2700 R09: 00007f32447c2700
      R10: 00007f32447c2700 R11: 0000000000000202 R12: 0000000000000000
      R13: 00007ffe33edec4f R14: 00007f32447c29c0 R15: 0000000000000000
      
      Fixes: ba51b6be ("net: Fix RCU splat in af_key")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: David Ahern <dsa@cumulusnetworks.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36f41f8f
  37. 19 7月, 2017 1 次提交