17 Dec, 2010

29 commits

  • Clean up.

    The trend in the other XDR encoder functions is to BUG() when encoding
    problems occur, since a problem here is always due to a local coding
    error. Then, instead of a status, zero is unconditionally returned.

    Update the mount client XDR encoders to behave this way.

    To finish the update, use the new-style be32_to_cpup() and
    cpu_to_be32() macros, and compute the buffer sizes using raw integers
    instead of sizeof(). This matches the conventions used in other XDR
    functions.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    The trend in the other XDR encoder functions is to BUG() when encoding
    problems occur, since a problem here is always due to a local coding
    error. Then, instead of a status, zero is unconditionally returned.

    Update the NSM XDR encoders to behave this way.

    To finish the update, use the new-style be32_to_cpup() and
    cpu_to_be32() macros, and compute the buffer sizes using raw integers
    instead of sizeof(). This matches the conventions used in other XDR
    functions

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    .../linux/nfs-2.6/fs/nfs/nfs4xdr.c: In function ‘decode_getdeviceinfo’:
    .../linux/nfs-2.6/fs/nfs/nfs4xdr.c:5008: warning: comparison between signed and unsigned integer expressions

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    The pointer returned by ->decode_dirent() is no longer used as a
    pointer. The only call site (xdr_decode() in fs/nfs/dir.c) simply
    extracts the errno value encoded in the pointer. Replace the
    returned pointer with a standard integer errno return value.

    Also, pass the "server" argument as part of the nfs_entry instead of
    as a separate parameter. It's faster to derive "server" in
    nfs_readdir_xdr_to_array() since we already have the directory's inode
    handy. "server" ought to be invariant for a set of entries in the
    same directory, right?

    The legacy versions of decode_dirent() don't use "server" anyway, so
    it's wasted work for them to derive and pass "server" for each entry.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • When computing the length of the header, be sure to include the
    four octets consumed by "count".

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up. nlmdbg_cookie2a() is used only in svclock.c.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    When I was making other changes in this area, checkscript.pl
    complained about the use of leading blanks in the PROC macros in the
    xdr files.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    Remove old-style NFSv4 XDR macros in favor of the style now used in
    fs/nfs/nfs4xdr.c. These were forgotten during the recent nfs4xdr.c
    rewrite.

    Additional whitespace cleanup adds to the size of this patch.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    Remove old-style NFSv4 XDR macros in favor of the style now used in
    fs/nfs/nfs4xdr.c. These were forgotten during the recent nfs4xdr.c
    rewrite.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • We'd like to prevent local buffer overflows caused by malicious or
    broken servers. New xdr_stream style decoders can do that.

    For efficiency, we also want to be able to pass xdr_streams from
    call_encode() to all XDR encoding functions, rather than building
    an xdr_stream in every XDR encoding function in the kernel.

    Same idea as the NLM v3 XDR overhaul.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    Move the timestamp decoder to match the placement and naming
    conventions of the other helpers. Fold xdr_decode_fattr() into
    decode_fattr3(), which is now it's only user. Fold
    xdr_decode_wcc_attr() into decode_wcc_attr(), which is now it's only
    user.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up. Remove unused legacy result decoder functions, and any
    now unused decoder helper functions.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • The naming scheme of the new decoder functions, which follows the
    NFSv4 XDR decoder functions, is slightly different than the scheme
    used for the old functions. Rename the functions as a separate
    step to keep the patches clean.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • We'd like to prevent local buffer overflows caused by malicious or
    broken servers. New xdr_stream style decoders can do that.

    For efficiency, we also eventually want to be able to pass xdr_streams
    from call_decode() to all XDR decoding functions, rather than building
    an xdr_stream in every XDR decoding function in the kernel.

    Static helper functions are left without the "inline" directive. This
    allows the compiler to choose automatically how to optimize these for
    size or speed.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up. Move the timestamp and the sattr encoder to match the
    placement convention of the other helpers, update their coding style,
    and refresh their documenting comments.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up. Remove unused legacy argument encoder functions, and any
    now unused encoder helper functions.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • The naming scheme of the new encoder functions, which follows the
    NFSv4 XDR encoder functions, is slightly different than the scheme
    used for the old functions. Rename the functions as a separate
    step to keep the patches clean.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • We're interested in taking advantage of the safety benefits of
    xdr_streams. These data structures allow more careful checking for
    buffer overflow while encoding. More careful type checking is also
    introduced in the new functions.

    For efficiency, we also eventually want to be able to pass xdr_streams
    from call_encode() to all XDR encoding functions, rather than building
    an xdr_stream in every XDR encoding function in the kernel. To do
    this means all encoders must be ready to handle a passed-in
    xdr_stream.

    The new encoders follow the modern paradigm for XDR encoders: BUG on
    error, and always return a zero status code.

    Static helper functions are left without the "inline" directive. This
    allows the compiler to choose automatically how to optimize these for
    size or speed.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • We'd like to prevent local buffer overflows caused by malicious or
    broken servers. New xdr_stream style decoders can do that.

    For efficiency, we also eventually want to be able to pass xdr_streams
    from call_encode() and call_decode() to all XDR encoding functions,
    rather than building an xdr_stream in every XDR encoding and decoding
    function in the kernel.

    To do all of this, rewrite the XDR encoding and decoding functions in
    fs/lockd/xdr.c to use xdr_streams. This makes them more or less
    incompatible with server-side XDR helper functions, so break them out
    into a separate source file.

    Static helper functions are left without the "inline" directive. This
    allows the compiler to choose automatically how to optimize these for
    size or speed.

    SHARE-related functionality doesn't seem to be used, as those
    functions are hiding behind a #define that isn't set anywhere that I
    can find. And, they've been in there forever (at least as far back as
    the kernel's git history goes), yet remain unused. Let's take the
    opportunity to bin them. It should be easy enough for someone to
    introduce proper XDR functions if at some point SHARE-related NLM
    functionality is desired.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    Move the timestamp decoder to match the placement and naming
    conventions of the other helpers. Fold xdr_decode_fattr() into
    decode_fattr(), which is now it's only user.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up. Remove unused legacy result decoder functions, and any
    now unused decoder helper functions.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • We'd like to prevent local buffer overflows caused by malicious or
    broken servers. New xdr_stream style decoders can do that.

    For efficiency, we also eventually want to be able to pass xdr_streams
    from call_decode() to all XDR decoding functions, rather than building
    an xdr_stream in every XDR decoding function in the kernel.

    nfs_decode_dirent() is renamed to follow the naming convention of the
    other two dirent decoders.

    Static helper functions are left without the "inline" directive. This
    allows the compiler to choose automatically how to optimize these for
    size or speed.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    To distinguish more clearly between the on-the-wire NFSERR_ value and
    our local errno values, use the proper type for the argument of
    nfs_stat_to_errno().

    Add a documenting comment appropriate for a global function shared
    outside this source file.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up.

    The new helper functions are kept in order by section of RFC 1094.
    Move the two timestamp encoders we're keeping, update their coding
    style, and refresh their documenting comments.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up: Remove unused legacy argument encoder functions, and any
    now unused encoder helper functions.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • We're interested in taking advantage of the safety benefits of
    xdr_streams. These data structures allow more careful checking for
    buffer overflow while encoding. More careful type checking is also
    introduced in the new functions.

    For efficiency, we also eventually want to be able to pass xdr_streams
    from call_encode() to all XDR encoding functions, rather than building
    an xdr_stream in every XDR encoding function in the kernel. To do
    this means all encoders must be ready to handle a passed-in
    xdr_stream.

    The new encoders follow the modern paradigm for XDR encoders: BUG on
    any error, and always return a zero status code.

    Static helper functions are left without the "inline" directive. This
    allows the compiler to choose automatically how to optimize these for
    size or speed.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
    lguest: populate initial_page_table
    lguest: restore boot speed
    lguest: fix crash lguest_time_init

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2:
    nilfs2: fix regression of garbage collection ioctl

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Input: define separate EVIOCGKEYCODE_V2/EVIOCSKEYCODE_V2
    Input: wacom - add another Bamboo Pen ID (0xd4)

    Linus Torvalds
     

16 Dec, 2010

10 commits

  • Two x86 patches broke lguest:
    1) v2.6.35-492-g72d7c3b, which changed x86 to use the memblock allocator.

    In lguest, the host places linear page tables at the top of mem, which
    used to be enough to get us up to the swapper_pg_dir page tables. With
    the first patch, the direct mapping tables used that memory:

    Before: kernel direct mapping tables up to 4000000 @ 7000-1a000
    After: kernel direct mapping tables up to 4000000 @ 3fed000-4000000

    I initially fixed this by lying about the amount of memory we had, so
    the kernel wouldn't blatt the lguest boot pagetables (yuk!), but then...

    2) v2.6.36-rc8-54-gb40827f, which made x86 boot use initial_page_table.

    This was initialized in a part of head_32.S which isn't executed by
    lguest; it is then copied into swapper_pg_dir. So we have to initialize
    it; and anyway we switch to it before we blatt the old tables, so that
    fixes the previous damage as well.

    For the moment, I cut & pasted the code into lguest's boot code, but
    next merge window I will merge them.

    Signed-off-by: Rusty Russell
    Cc: Jeremy Fitzhardinge
    Cc: Konrad Rzeszutek Wilk
    To: x86@kernel.org

    Rusty Russell
     
  • lguest is dumb and drops *all* the pagetables for set_pte (which is
    only used for kernel mapping manipulation, so it's OK without highmem).

    But it's used a lot in boot, too. As a guest optimization, we
    suppressed this flushing until the first page switch. Now we have
    initial_page_table, that happens much earlier, so extend the heuristic
    to wait until we switch to something other than the swapper_pg_dir or
    initial_page_table.

    As measured on my laptop under kvm, this dropped the time-to-mount-root
    from 48 seconds to 4.3 seconds.

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • fe25c7fc2e "x86: lguest: Convert to new irq chip functions" converted
    enable_lguest_irq() to take a struct irq_data *, but didn't fix the one
    internal caller.

    Signed-off-by: Rusty Russell
    To: x86@kernel.org

    Rusty Russell
     
  • On 2.6.37-rc1, garbage collection ioctl of nilfs was broken due to the
    commit 263d90cefc7d82a0 ("nilfs2: remove own inode hash used for GC"),
    and leading to filesystem corruption.

    The patch doesn't queue gc-inodes for log writer if they are reused
    through the vfs inode cache. Here, gc-inode is the inode which
    buffers blocks to be relocated on GC. That patch queues gc-inodes in
    nilfs_init_gcinode() function, but this function is not called when
    they don't have I_NEW flag. Thus, some of live blocks are wrongly
    overrode without being moved to new logs.

    This resolves the problem by moving the gc-inode queueing to an outer
    function to ensure it's done right.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: ghash-intel - ghash-clmulni-intel_glue needs err.h

    Linus Torvalds
     
  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    ext4: fix typo which broke '..' detection in ext4_find_entry()
    ext4: Turn off multiple page-io submission by default

    Linus Torvalds
     
  • Without this, gcc 4.5 won't compile xen-netfront and xen-blkfront, where
    this is being used to specify array sizes.

    Signed-off-by: Jan Beulich
    Signed-off-by: Jeremy Fitzhardinge
    Cc: Jens Axboe
    Cc: David Miller
    Cc: Stable Kernel
    Signed-off-by: Linus Torvalds

    Jeremy Fitzhardinge
     
  • The MSM main git tree has changed over to this new address.

    Signed-off-by: Daniel Walker
    Signed-off-by: Linus Torvalds

    Daniel Walker
     
  • The install_special_mapping routine (used, for example, to setup the
    vdso) skips the security check before insert_vm_struct, allowing a local
    attacker to bypass the mmap_min_addr security restriction by limiting
    the available pages for special mappings.

    bprm_mm_init() also skips the check, and although I don't think this can
    be used to bypass any restrictions, I don't see any reason not to have
    the security check.

    $ uname -m
    x86_64
    $ cat /proc/sys/vm/mmap_min_addr
    65536
    $ cat install_special_mapping.s
    section .bss
    resb BSS_SIZE
    section .text
    global _start
    _start:
    mov eax, __NR_pause
    int 0x80
    $ nasm -D__NR_pause=29 -DBSS_SIZE=0xfffed000 -f elf -o install_special_mapping.o install_special_mapping.s
    $ ld -m elf_i386 -Ttext=0x10000 -Tbss=0x11000 -o install_special_mapping install_special_mapping.o
    $ ./install_special_mapping &
    [1] 14303
    $ cat /proc/14303/maps
    0000f000-00010000 r-xp 00000000 00:00 0 [vdso]
    00010000-00011000 r-xp 00001000 00:19 2453665 /home/taviso/install_special_mapping
    00011000-ffffe000 rwxp 00000000 00:00 0 [stack]

    It's worth noting that Red Hat are shipping with mmap_min_addr set to
    4096.

    Signed-off-by: Tavis Ormandy
    Acked-by: Kees Cook
    Acked-by: Robert Swiecki
    [ Changed to not drop the error code - akpm ]
    Reviewed-by: James Morris
    Signed-off-by: Linus Torvalds

    Tavis Ormandy
     

15 Dec, 2010

1 commit