1. 23 6月, 2015 1 次提交
  2. 05 5月, 2015 1 次提交
  3. 27 2月, 2015 1 次提交
  4. 18 2月, 2015 1 次提交
    • D
      svcrpc: fix memory leak in gssp_accept_sec_context_upcall · a1d1e9be
      David Ramos 提交于
      Our UC-KLEE tool found a kernel memory leak of 512 bytes (on x86_64) for
      each call to gssp_accept_sec_context_upcall()
      (net/sunrpc/auth_gss/gss_rpc_upcall.c). Since it appears that this call
      can be triggered by remote connections (at least, from a cursory a
      glance at the call chain), it may be exploitable to cause kernel memory
      exhaustion. We found the bug in kernel 3.16.3, but it appears to date
      back to commit 9dfd87da (2013-08-20).
      
      The gssp_accept_sec_context_upcall() function performs a pair of calls
      to gssp_alloc_receive_pages() and gssp_free_receive_pages().  The first
      allocates memory for arg->pages.  The second then frees the pages
      pointed to by the arg->pages array, but not the array itself.
      Reported-by: NDavid A. Ramos <daramos@stanford.edu>
      Fixes: 9dfd87da ("rpc: fix huge kmalloc's in gss-proxy”)
      Signed-off-by: NDavid A. Ramos <daramos@stanford.edu>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      a1d1e9be
  5. 10 12月, 2014 1 次提交
  6. 25 11月, 2014 1 次提交
  7. 14 11月, 2014 1 次提交
    • J
      sunrpc: fix sleeping under rcu_read_lock in gss_stringify_acceptor · b3ecba09
      Jeff Layton 提交于
      Bruce reported that he was seeing the following BUG pop:
      
          BUG: sleeping function called from invalid context at mm/slab.c:2846
          in_atomic(): 0, irqs_disabled(): 0, pid: 4539, name: mount.nfs
          2 locks held by mount.nfs/4539:
          #0:  (nfs_clid_init_mutex){+.+.+.}, at: [<ffffffffa01c0a9a>] nfs4_discover_server_trunking+0x4a/0x2f0 [nfsv4]
          #1:  (rcu_read_lock){......}, at: [<ffffffffa00e3185>] gss_stringify_acceptor+0x5/0xb0 [auth_rpcgss]
          Preemption disabled at:[<ffffffff81a4f082>] printk+0x4d/0x4f
      
          CPU: 3 PID: 4539 Comm: mount.nfs Not tainted 3.18.0-rc1-00013-g5b095e99 #3393
          Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
          ffff880021499390 ffff8800381476a8 ffffffff81a534cf 0000000000000001
          0000000000000000 ffff8800381476c8 ffffffff81097854 00000000000000d0
          0000000000000018 ffff880038147718 ffffffff8118e4f3 0000000020479f00
          Call Trace:
          [<ffffffff81a534cf>] dump_stack+0x4f/0x7c
          [<ffffffff81097854>] __might_sleep+0x114/0x180
          [<ffffffff8118e4f3>] __kmalloc+0x1a3/0x280
          [<ffffffffa00e31d8>] gss_stringify_acceptor+0x58/0xb0 [auth_rpcgss]
          [<ffffffffa00e3185>] ? gss_stringify_acceptor+0x5/0xb0 [auth_rpcgss]
          [<ffffffffa006b438>] rpcauth_stringify_acceptor+0x18/0x30 [sunrpc]
          [<ffffffffa01b0469>] nfs4_proc_setclientid+0x199/0x380 [nfsv4]
          [<ffffffffa01b04d0>] ? nfs4_proc_setclientid+0x200/0x380 [nfsv4]
          [<ffffffffa01bdf1a>] nfs40_discover_server_trunking+0xda/0x150 [nfsv4]
          [<ffffffffa01bde45>] ? nfs40_discover_server_trunking+0x5/0x150 [nfsv4]
          [<ffffffffa01c0acf>] nfs4_discover_server_trunking+0x7f/0x2f0 [nfsv4]
          [<ffffffffa01c8e24>] nfs4_init_client+0x104/0x2f0 [nfsv4]
          [<ffffffffa01539b4>] nfs_get_client+0x314/0x3f0 [nfs]
          [<ffffffffa0153780>] ? nfs_get_client+0xe0/0x3f0 [nfs]
          [<ffffffffa01c83aa>] nfs4_set_client+0x8a/0x110 [nfsv4]
          [<ffffffffa0069708>] ? __rpc_init_priority_wait_queue+0xa8/0xf0 [sunrpc]
          [<ffffffffa01c9b2f>] nfs4_create_server+0x12f/0x390 [nfsv4]
          [<ffffffffa01c1472>] nfs4_remote_mount+0x32/0x60 [nfsv4]
          [<ffffffff81196489>] mount_fs+0x39/0x1b0
          [<ffffffff81166145>] ? __alloc_percpu+0x15/0x20
          [<ffffffff811b276b>] vfs_kern_mount+0x6b/0x150
          [<ffffffffa01c1396>] nfs_do_root_mount+0x86/0xc0 [nfsv4]
          [<ffffffffa01c1784>] nfs4_try_mount+0x44/0xc0 [nfsv4]
          [<ffffffffa01549b7>] ? get_nfs_version+0x27/0x90 [nfs]
          [<ffffffffa0161a2d>] nfs_fs_mount+0x47d/0xd60 [nfs]
          [<ffffffff81a59c5e>] ? mutex_unlock+0xe/0x10
          [<ffffffffa01606a0>] ? nfs_remount+0x430/0x430 [nfs]
          [<ffffffffa01609c0>] ? nfs_clone_super+0x140/0x140 [nfs]
          [<ffffffff81196489>] mount_fs+0x39/0x1b0
          [<ffffffff81166145>] ? __alloc_percpu+0x15/0x20
          [<ffffffff811b276b>] vfs_kern_mount+0x6b/0x150
          [<ffffffff811b5830>] do_mount+0x210/0xbe0
          [<ffffffff811b54ca>] ? copy_mount_options+0x3a/0x160
          [<ffffffff811b651f>] SyS_mount+0x6f/0xb0
          [<ffffffff81a5c852>] system_call_fastpath+0x12/0x17
      
      Sleeping under the rcu_read_lock is bad. This patch fixes it by dropping
      the rcu_read_lock before doing the allocation and then reacquiring it
      and redoing the dereference before doing the copy. If we find that the
      string has somehow grown in the meantime, we'll reallocate and try again.
      
      Cc: <stable@vger.kernel.org> # v3.17+
      Reported-by: N"J. Bruce Fields" <bfields@fieldses.org>
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      b3ecba09
  8. 04 8月, 2014 4 次提交
  9. 13 7月, 2014 2 次提交
  10. 23 6月, 2014 1 次提交
  11. 31 5月, 2014 1 次提交
  12. 19 5月, 2014 1 次提交
  13. 18 4月, 2014 1 次提交
  14. 17 2月, 2014 2 次提交
  15. 11 2月, 2014 1 次提交
  16. 28 1月, 2014 1 次提交
    • J
      sunrpc: turn warn_gssd() log message into a dprintk() · 0ea9de0e
      Jeff Layton 提交于
      The original printk() made sense when the GSSAPI codepaths were called
      only when sec=krb5* was explicitly requested. Now however, in many cases
      the nfs client will try to acquire GSSAPI credentials by default, even
      when it's not requested.
      
      Since we don't have a great mechanism to distinguish between the two
      cases, just turn the pr_warn into a dprintk instead. With this change we
      can also get rid of the ratelimiting.
      
      We do need to keep the EXPORT_SYMBOL(gssd_running) in place since
      auth_gss.ko needs it and sunrpc.ko provides it. We can however,
      eliminate the gssd_running call in the nfs code since that's a bit of a
      layering violation.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      0ea9de0e
  17. 25 1月, 2014 1 次提交
  18. 08 1月, 2014 1 次提交
  19. 07 1月, 2014 3 次提交
  20. 07 12月, 2013 1 次提交
  21. 27 11月, 2013 1 次提交
  22. 29 10月, 2013 2 次提交
  23. 27 10月, 2013 1 次提交
    • J
      sunrpc: trim off EC bytes in GSSAPI v2 unwrap · cf4c024b
      Jeff Layton 提交于
      As Bruce points out in RFC 4121, section 4.2.3:
      
         "In Wrap tokens that provide for confidentiality, the first 16 octets
          of the Wrap token (the "header", as defined in section 4.2.6), SHALL
          be appended to the plaintext data before encryption.  Filler octets
          MAY be inserted between the plaintext data and the "header.""
      
      ...and...
      
         "In Wrap tokens with confidentiality, the EC field SHALL be used to
          encode the number of octets in the filler..."
      
      It's possible for the client to stuff different data in that area on a
      retransmission, which could make the checksum come out wrong in the DRC
      code.
      
      After decrypting the blob, we should trim off any extra count bytes in
      addition to the checksum blob.
      Reported-by: N"J. Bruce Fields" <bfields@fieldses.org>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      cf4c024b
  24. 10 10月, 2013 2 次提交
  25. 09 10月, 2013 2 次提交
  26. 18 9月, 2013 1 次提交
    • J
      RPCSEC_GSS: fix crash on destroying gss auth · a0f6ed8e
      J. Bruce Fields 提交于
      This fixes a regression since  eb6dc19d
      "RPCSEC_GSS: Share all credential caches on a per-transport basis" which
      could cause an occasional oops in the nfsd code (see below).
      
      The problem was that an auth was left referencing a client that had been
      freed.  To avoid this we need to ensure that auths are shared only
      between descendants of a common client; the fact that a clone of an
      rpc_client takes a reference on its parent then ensures that the parent
      client will last as long as the auth.
      
      Also add a comment explaining what I think was the intention of this
      code.
      
        general protection fault: 0000 [#1] PREEMPT SMP
        Modules linked in: rpcsec_gss_krb5 nfsd auth_rpcgss oid_registry nfs_acl lockd sunrpc
        CPU: 3 PID: 4071 Comm: kworker/u8:2 Not tainted 3.11.0-rc2-00182-g025145f #1665
        Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
        Workqueue: nfsd4_callbacks nfsd4_do_callback_rpc [nfsd]
        task: ffff88003e206080 ti: ffff88003c384000 task.ti: ffff88003c384000
        RIP: 0010:[<ffffffffa00001f3>]  [<ffffffffa00001f3>] rpc_net_ns+0x53/0x70 [sunrpc]
        RSP: 0000:ffff88003c385ab8  EFLAGS: 00010246
        RAX: 6b6b6b6b6b6b6b6b RBX: ffff88003af9a800 RCX: 0000000000000002
        RDX: ffffffffa00001a5 RSI: 0000000000000001 RDI: ffffffff81e284e0
        RBP: ffff88003c385ad8 R08: 0000000000000001 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000015 R12: ffff88003c990840
        R13: ffff88003c990878 R14: ffff88003c385ba8 R15: ffff88003e206080
        FS:  0000000000000000(0000) GS:ffff88003fd80000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
        CR2: 00007fcdf737e000 CR3: 000000003ad2b000 CR4: 00000000000006e0
        Stack:
         ffffffffa00001a5 0000000000000006 0000000000000006 ffff88003af9a800
         ffff88003c385b08 ffffffffa00d52a4 ffff88003c385ba8 ffff88003c751bd8
         ffff88003c751bc0 ffff88003e113600 ffff88003c385b18 ffffffffa00d530c
        Call Trace:
         [<ffffffffa00001a5>] ? rpc_net_ns+0x5/0x70 [sunrpc]
         [<ffffffffa00d52a4>] __gss_pipe_release+0x54/0x90 [auth_rpcgss]
         [<ffffffffa00d530c>] gss_pipe_free+0x2c/0x30 [auth_rpcgss]
         [<ffffffffa00d678b>] gss_destroy+0x9b/0xf0 [auth_rpcgss]
         [<ffffffffa000de63>] rpcauth_release+0x23/0x30 [sunrpc]
         [<ffffffffa0001e81>] rpc_release_client+0x51/0xb0 [sunrpc]
         [<ffffffffa00020d5>] rpc_shutdown_client+0xe5/0x170 [sunrpc]
         [<ffffffff81098a14>] ? cpuacct_charge+0xa4/0xb0
         [<ffffffff81098975>] ? cpuacct_charge+0x5/0xb0
         [<ffffffffa019556f>] nfsd4_process_cb_update.isra.17+0x2f/0x210 [nfsd]
         [<ffffffff819a4ac0>] ? _raw_spin_unlock_irq+0x30/0x60
         [<ffffffff819a4acb>] ? _raw_spin_unlock_irq+0x3b/0x60
         [<ffffffff810703ab>] ? process_one_work+0x15b/0x510
         [<ffffffffa01957dd>] nfsd4_do_callback_rpc+0x8d/0xa0 [nfsd]
         [<ffffffff8107041e>] process_one_work+0x1ce/0x510
         [<ffffffff810703ab>] ? process_one_work+0x15b/0x510
         [<ffffffff810712ab>] worker_thread+0x11b/0x370
         [<ffffffff81071190>] ? manage_workers.isra.24+0x2b0/0x2b0
         [<ffffffff8107854b>] kthread+0xdb/0xe0
         [<ffffffff819a4ac0>] ? _raw_spin_unlock_irq+0x30/0x60
         [<ffffffff81078470>] ? __init_kthread_worker+0x70/0x70
         [<ffffffff819ac7dc>] ret_from_fork+0x7c/0xb0
         [<ffffffff81078470>] ? __init_kthread_worker+0x70/0x70
        Code: a5 01 00 a0 31 d2 31 f6 48 c7 c7 e0 84 e2 81 e8 f4 91 0a e1 48 8b 43 60 48 c7 c2 a5 01 00 a0 be 01 00 00 00 48 c7 c7 e0 84 e2 81 <48> 8b 98 10 07 00 00 e8 91 8f 0a e1 e8
        +3c 4e 07 e1 48 83 c4 18
        RIP  [<ffffffffa00001f3>] rpc_net_ns+0x53/0x70 [sunrpc]
         RSP <ffff88003c385ab8>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      a0f6ed8e
  27. 12 9月, 2013 1 次提交
  28. 06 9月, 2013 3 次提交