08 Dec, 2011

1 commit


07 Dec, 2011

1 commit

  • expkey_parse() oopses when handling a 0 length export. This is easily
    triggerable from usermode by writing 0 bytes into
    '/proc/[proc id]/net/rpc/nfsd.fh/channel'.

    Below is the log:

    [ 1402.286893] BUG: unable to handle kernel paging request at ffff880077c49fff
    [ 1402.287632] IP: [] expkey_parse+0x28/0x2e1
    [ 1402.287632] PGD 2206063 PUD 1fdfd067 PMD 1ffbc067 PTE 8000000077c49160
    [ 1402.287632] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
    [ 1402.287632] CPU 1
    [ 1402.287632] Pid: 20198, comm: trinity Not tainted 3.2.0-rc2-sasha-00058-gc65cd37 #6
    [ 1402.287632] RIP: 0010:[] [] expkey_parse+0x28/0x2e1
    [ 1402.287632] RSP: 0018:ffff880077f0fd68 EFLAGS: 00010292
    [ 1402.287632] RAX: ffff880077c49fff RBX: 00000000ffffffea RCX: 0000000001043400
    [ 1402.287632] RDX: 0000000000000000 RSI: ffff880077c4a000 RDI: ffffffff82283de0
    [ 1402.287632] RBP: ffff880077f0fe18 R08: 0000000000000001 R09: ffff880000000000
    [ 1402.287632] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880077c4a000
    [ 1402.287632] R13: ffffffff82283de0 R14: 0000000001043400 R15: ffffffff82283de0
    [ 1402.287632] FS: 00007f25fec3f700(0000) GS:ffff88007d400000(0000) knlGS:0000000000000000
    [ 1402.287632] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 1402.287632] CR2: ffff880077c49fff CR3: 0000000077e1d000 CR4: 00000000000406e0
    [ 1402.287632] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 1402.287632] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    [ 1402.287632] Process trinity (pid: 20198, threadinfo ffff880077f0e000, task ffff880077db17b0)
    [ 1402.287632] Stack:
    [ 1402.287632] ffff880077db17b0 ffff880077c4a000 ffff880077f0fdb8 ffffffff810b411e
    [ 1402.287632] ffff880000000000 ffff880077db17b0 ffff880077c4a000 ffffffff82283de0
    [ 1402.287632] 0000000001043400 ffffffff82283de0 ffff880077f0fde8 ffffffff81111f63
    [ 1402.287632] Call Trace:
    [ 1402.287632] [] ? lock_release+0x1af/0x1bc
    [ 1402.287632] [] ? might_fault+0x97/0x9e
    [ 1402.287632] [] ? might_fault+0x4e/0x9e
    [ 1402.287632] [] cache_do_downcall+0x3e/0x4f
    [ 1402.287632] [] cache_write.clone.16+0xbb/0x130
    [ 1402.287632] [] ? cache_write_pipefs+0x1a/0x1a
    [ 1402.287632] [] cache_write_procfs+0x19/0x1b
    [ 1402.287632] [] proc_reg_write+0x8e/0xad
    [ 1402.287632] [] vfs_write+0xaa/0xfd
    [ 1402.287632] [] ? fget_light+0x35/0x9e
    [ 1402.287632] [] sys_write+0x48/0x6f
    [ 1402.287632] [] system_call_fastpath+0x16/0x1b
    [ 1402.287632] Code: c0 c9 c3 55 48 63 d2 48 89 e5 48 8d 44 32 ff 41 57 41 56 41 55 41 54 53 bb ea ff ff ff 48 81 ec 88 00 00 00 48 89 b5 58 ff ff ff
    [ 1402.287632] 38 0a 0f 85 89 02 00 00 c6 00 00 48 8b 3d 44 4a e5 01 48 85
    [ 1402.287632] RIP [] expkey_parse+0x28/0x2e1
    [ 1402.287632] RSP
    [ 1402.287632] CR2: ffff880077c49fff
    [ 1402.287632] ---[ end trace 368ef53ff773a5e3 ]---

    Cc: "J. Bruce Fields"
    Cc: Neil Brown
    Cc: linux-nfs@vger.kernel.org
    Cc: stable@kernel.org
    Signed-off-by: Sasha Levin
    Signed-off-by: J. Bruce Fields

    Sasha Levin
     

14 Sep, 2011

2 commits

  • There are no more users...

    Signed-off-by: Trond Myklebust
    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields

    Trond Myklebust
     
  • The current code is sort of hackish in that it assumes a referral is always
    matched to an export. When we add support for junctions that may not be the
    case.
    We can replace nfsd4_path() with a function that encodes the components
    directly from the dentries. Since nfsd4_path is currently the only user of
    the 'ex_pathname' field in struct svc_export, this has the added benefit
    of allowing us to get rid of that.

    Signed-off-by: Trond Myklebust
    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields

    Trond Myklebust
     

31 Aug, 2011

1 commit


16 Jul, 2011

1 commit

  • As promised in feature-removal-schedule.txt it is time to
    remove the nfsctl system call.

    Userspace has perferred to not use this call throughout 2.6 and it has been
    excluded in the default configuration since 2.6.36 (9 months ago).

    So this patch removes all the code that was being compiled out.

    There are still references to sys_nfsctl in various arch systemcall tables
    and related code. These should be cleaned out too, probably in the next
    merge window.

    Signed-off-by: NeilBrown
    Signed-off-by: J. Bruce Fields

    NeilBrown
     

30 Apr, 2011

1 commit

  • When PUTFH is followed by an operation that uses the filehandle, and
    when the current client is using a security flavor that is inconsistent
    with the given filehandle, we have a choice: we can return WRONGSEC
    either when the current filehandle is set using the PUTFH, or when the
    filehandle is first used by the following operation.

    Follow the recommendations of RFC 5661 in making this choice.

    (Our current behavior prevented the client from doing security
    negotiation by returning WRONGSEC on PUTFH+SECINFO_NO_NAME.)

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

08 Mar, 2011

1 commit


14 Jan, 2011

1 commit

  • We've long had these pointless #ifdef MSNFS's sprinkled throughout the
    code--pointless because MSNFS is always defined (and we give no config
    option to make that easy to change). So we could just remove the
    ifdef's and compile the resulting code unconditionally.

    But as long as we're there: why not just rip out this code entirely?
    The only purpose is to implement the "msnfs" export option which turns
    on Windows-like behavior in some cases, and:

    - the export option isn't documented anywhere;
    - the userland utilities (which would need to be able to parse
    "msnfs" in an export file) don't support it;
    - I don't know how to maintain this, as I don't know what the
    proper behavior is; and
    - google shows no evidence that anyone has ever used this.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

27 Sep, 2010

2 commits


23 Sep, 2010

1 commit


08 Sep, 2010

1 commit


04 May, 2010

1 commit


23 Apr, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

17 Mar, 2010

1 commit


09 Feb, 2010

1 commit

  • Commit f39bde24b275ddc45d fixed the error return from PUTROOTFH in the
    case where there is no pseudofilesystem.

    This is really a case we shouldn't hit on a correctly configured server:
    in the absence of a root filehandle, there's no point accepting version
    4 NFS rpc calls at all.

    But the shared responsibility between kernel and userspace here means
    the kernel on its own can't eliminate the possiblity of this happening.
    And we have indeed gotten this wrong in distro's, so new client-side
    mount code that attempts to negotiate v4 by default first has to work
    around this case.

    Therefore when commit f39bde24b275ddc45d arrived at roughly the same
    time as the new v4-default mount code, which explicitly checked only for
    the previous error, the result was previously fine mounts suddenly
    failing.

    We'll fix both sides for now: revert the error change, and make the
    client-side mount workaround more robust.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

16 Dec, 2009

5 commits

  • The new .h files have paths at the top that are now out of date. While
    we're here, just remove all of those from fs/nfsd; they never served any
    purpose.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Most of this can be trivially moved to a private header as well.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • I can't see any use for writeable V4ROOT exports.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • We want to allow exports of symlinks, to allow mountd to communicate to
    the kernel which symlinks lead to exports, and hence which symlinks need
    to be visible on the pseudofilesystem.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • NFSv4 differs from v2 and v3 in that it presents a single unified
    filesystem tree, whereas v2 and v3 exported multiple filesystem (whose
    roots could be found using a separate mount protocol).

    Our original NFSv4 server implementation asked the administrator to
    designate a single filesystem as the NFSv4 root, then to mount
    filesystems they wished to export underneath. (Often using bind mounts
    of already-existing filesystems.)

    This was conceptually simple, and allowed easy implementation, but
    created a serious obstacle to upgrading between v2/v3: since the paths
    to v4 filesystems were different, administrators would have to adjust
    all the paths in client-side mount commands when switching to v4.

    Various workarounds are possible. For example, the administrator could
    export "/" and designate it as the v4 root. However, the security risks
    of that approach are obvious, and in any case we shouldn't be requiring
    the administrator to take extra steps to fix this problem; instead, the
    server should present consistent paths across different versions by
    default.

    These patches take a modified version of that approach: we provide a new
    export option which exports only a subset of a filesystem. With this
    flag, it becomes safe for mountd to export "/" by default, with no need
    for additional configuration.

    We begin just by defining the new flag.

    Signed-off-by: Steve Dickson
    Signed-off-by: J. Bruce Fields

    Steve Dickson
     

15 Dec, 2009

2 commits


29 Sep, 2009

1 commit

  • We really shouldn't hit this case at all, and forthcoming kernel and
    nfs-utils changes should eliminate this case; if it does happen,
    consider it a bug rather than reporting an error that doesn't really
    make sense for the operation (since there's no reason for a server to be
    accepting v4 traffic yet have no root filehandle).

    Also move some exp_pseudoroot code into a helper function while we're
    here.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

23 Sep, 2009

1 commit

  • Make all seq_operations structs const, to help mitigate against
    revectoring user-triggerable function pointers.

    This is derived from the grsecurity patch, although generated from scratch
    because it's simpler than extracting the changes from there.

    Signed-off-by: James Morris
    Acked-by: Serge Hallyn
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    James Morris
     

04 Sep, 2009

1 commit

  • nfsd4_path() allocates a temporary filehandle and then fails to free it
    before the function exits, leaking reference counts to the dentry and
    export that it refers to.

    Also, nfsd4_lookupp() puts the result of exp_pseudoroot() in a temporary
    filehandle which it releases on success of exp_pseudoroot() but not on
    failure; fix exp_pseudoroot to ensure that on failure it releases the
    filehandle before returning.

    Signed-off-by: Trond Myklebust
    Signed-off-by: J. Bruce Fields

    Trond Myklebust
     

10 Aug, 2009

1 commit

  • For events that are rare, such as referral DNS lookups, it makes limited
    sense to have a daemon constantly listening for upcalls on a channel. An
    alternative in those cases might simply be to run the app that fills the
    cache using call_usermodehelper_exec() and friends.

    The following patch allows the cache_detail to specify alternative upcall
    mechanisms for these particular cases.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

23 Jun, 2009

1 commit

  • * 'for-2.6.31' of git://fieldses.org/git/linux-nfsd: (60 commits)
    SUNRPC: Fix the TCP server's send buffer accounting
    nfsd41: Backchannel: minorversion support for the back channel
    nfsd41: Backchannel: cleanup nfs4.0 callback encode routines
    nfsd41: Remove ip address collision detection case
    nfsd: optimise the starting of zero threads when none are running.
    nfsd: don't take nfsd_mutex twice when setting number of threads.
    nfsd41: sanity check client drc maxreqs
    nfsd41: move channel attributes from nfsd4_session to a nfsd4_channel_attr struct
    NFS: kill off complicated macro 'PROC'
    sunrpc: potential memory leak in function rdma_read_xdr
    nfsd: minor nfsd_vfs_write cleanup
    nfsd: Pull write-gathering code out of nfsd_vfs_write
    nfsd: track last inode only in use_wgather case
    sunrpc: align cache_clean work's timer
    nfsd: Use write gathering only with NFSv2
    NFSv4: kill off complicated macro 'PROC'
    NFSv4: do exact check about attribute specified
    knfsd: remove unreported filehandle stats counters
    knfsd: fix reply cache memory corruption
    knfsd: reply cache cleanups
    ...

    Linus Torvalds
     

12 Jun, 2009

4 commits


24 Apr, 2009

1 commit


24 Oct, 2008

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (46 commits)
    [PATCH] fs: add a sanity check in d_free
    [PATCH] i_version: remount support
    [patch] vfs: make security_inode_setattr() calling consistent
    [patch 1/3] FS_MBCACHE: don't needlessly make it built-in
    [PATCH] move executable checking into ->permission()
    [PATCH] fs/dcache.c: update comment of d_validate()
    [RFC PATCH] touch_mnt_namespace when the mount flags change
    [PATCH] reiserfs: add missing llseek method
    [PATCH] fix ->llseek for more directories
    [PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent
    [PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup
    [PATCH vfs-2.6 4/6] vfs: remove unnecessary fsnotify_d_instantiate()
    [PATCH vfs-2.6 3/6] vfs: add __d_instantiate() helper
    [PATCH vfs-2.6 2/6] vfs: add d_ancestor()
    [PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT()
    [PATCH] get rid of on-stack dentry in udf
    [PATCH 2/2] anondev: switch to IDA
    [PATCH 1/2] anondev: init IDR statically
    [JFFS2] Use d_splice_alias() not d_add() in jffs2_lookup()
    [PATCH] Optimise NFS readdir hack slightly.
    ...

    Linus Torvalds
     

23 Oct, 2008

4 commits