02 Nov, 2010

6 commits

  • The existing asm-generic/stat.h specifies st_mtime, etc., as a 32-value,
    and works well for 32-bit architectures (currently microblaze, score,
    and 32-bit tile). However, for 64-bit architectures it isn't sufficient
    to return 32 bits of time_t; this isn't good insurance against the 2037
    rollover. (It also makes glibc support less convenient, since we can't
    use glibc's handy STAT_IS_KERNEL_STAT mode.)

    This change extends the two "timespec" fields for each of the three atime,
    mtime, and ctime fields from "int" to "long". As a result, on 32-bit
    platforms nothing changes, and 64-bit platforms will now work as expected.

    The only wrinkle is 32-bit userspace under 64-bit kernels taking advantage
    of COMPAT mode. For these, we leave the "struct stat64" definitions with
    the "int" versions of the time_t and nsec fields, so that architectures
    can implement compat_sys_stat64() and friends with sys_stat64(), etc.,
    and get the expected 32-bit structure layout. This requires a
    field-by-field copy in the kernel, implemented by the code guarded
    under __ARCH_WANT_STAT64.

    This does mean that the shape of the "struct stat" and "struct stat64"
    structures is different on a 64-bit kernel, but only one of the two
    structures should ever be used by any given process: "struct stat"
    is meant for 64-bit userspace only, and "struct stat64" for 32-bit
    userspace only. (On a 32-bit kernel the two structures continue to have
    the same shape, since "long" is 32 bits.)

    The alternative is keeping the two structures the same shape on 64-bit
    kernels, which means a 64-bit time_t in "struct stat64" for 32-bit
    processes. This is a little unnatural since 32-bit userspace can't
    do anything with 64 bits of time_t information, since time_t is just
    "long", not "int64_t"; and in any case 32-bit userspace might expect
    to be running under a 32-bit kernel, which can't provide the high 32
    bits anyway. In the case of a 32-bit kernel we'd then be extending the
    kernel's 32-bit time_t to 64 bits, then truncating it back to 32 bits
    again in userspace, for no particular reason. And, as mentioned above,
    if we have 64-bit time_t for 32-bit processes we can't easily use glibc's
    STAT_IS_KERNEL_STAT, since glibc's stat structure requires an embedded
    "struct timespec", which is a pair of "long" (32-bit) values in a 32-bit
    userspace. "Inventive" solutions are possible, but are pretty hacky.

    Signed-off-by: Chris Metcalf
    Acked-by: Arnd Bergmann

    Chris Metcalf
     
  • The kernel was allowing any component of the pt_regs to be updated either
    by signal handlers writing to the stack, or by processes writing via
    PTRACE_POKEUSR or PTRACE_SETREGS, which meant they could set their PL
    up from 0 to 1 and get access to kernel code and data (or, in practice,
    cause a kernel panic). We now always reset the ex1 field, allowing the
    user to set their ICS bit only.

    Signed-off-by: Chris Metcalf

    Chris Metcalf
     
  • This change is modelled on similar fixes for other architectures.
    The pt_regs "faultnum" member is set to the trap (fault) number that
    caused us to enter the kernel, and is INT_SWINT_1 for the syscall software
    interrupt. We already supported a pseudo value, INT_SWINT_1_SIGRETURN,
    that we used for the rt_sigreturn syscall; it avoided the case where
    one signal was handled, then we "tail-called" to another handler.

    This change avoids the similar case where we start to call one handler,
    then are preempted into another handler when we start trying to run
    the first handler. We clear ->faultnum after calling handle_signal(),
    and to be paranoid also in the case where there was no signal to deliver.

    Signed-off-by: Chris Metcalf

    Chris Metcalf
     
  • For the "initfree" boot argument it's not that big a deal, but
    to avoid warnings in the code, we check for a valid value before
    allowing the specified argument to override the kernel default.

    Signed-off-by: Chris Metcalf

    Chris Metcalf
     
  • This completes the tile migration to the new naming scheme for
    the architecture-specific irq management code.

    Signed-off-by: Chris Metcalf

    Chris Metcalf
     
  • This change makes KM_TYPE_NR independent of the actual deprecated
    list of km_type values, which are no longer used in tile code anywhere.
    For now we leave it set to 8, allowing that many nested mappings,
    and thus reserving 32MB of address space.

    A few remaining places using KM_* values were cleaned up as well.

    Signed-off-by: Chris Metcalf

    Chris Metcalf
     

01 Nov, 2010

14 commits


31 Oct, 2010

20 commits

  • Signed-off-by: Joe Perches
    Signed-off-by: Dmitry Torokhov

    Joe Perches
     
  • This one was only used for a nasty hack in nfsd, which has recently
    been removed.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • The caller allocated it, the caller should free it.

    The only issue so far is that we could change the flp pointer even on an
    error return if the fl_change callback failed. But we can simply move
    the flp assignment after the fl_change invocation, as the callers don't
    care about the flp return value if the setlease call failed.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Commit ffe8018c3424 ("initramfs: fix initramfs size calculation") broke
    32-bit big-endian arches like (on ARAnyM):

    VFS: Cannot open root device "hda1" or unknown-block(3,1)
    Please append a correct "root=" boot option; here are the available partitions:
    fe80 1059408 nfhd8 (driver?)
    fe81 921600 nfhd8p1 00000000-0000-0000-0000-000000000nfhd8p1
    fe82 137807 nfhd8p2 00000000-0000-0000-0000-000000000nfhd8p2
    0200 3280 fd0 (driver?)
    0201 3280 fd1 (driver?)
    0300 1059408 hda driver: ide-gd
    0301 921600 hda1 00000000-0000-0000-0000-000000000hda1
    0302 137807 hda2 00000000-0000-0000-0000-000000000hda2
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(3,1)

    As pointed out by Kerstin Jonsson , this
    is due to CONFIG_32BIT not being defined, so the initramfs size field is
    done as a 64-bit quad. On little-endian (like x86) this doesn matter,
    but on a big-endian machine the 32-bit reads will see the (zero) high
    bits.

    Only mips, s390, and score set CONFIG_32BIT for 32-bit builds, so fix it for
    all other 32-bit arches by inverting the logic and testing for CONFIG_64BIT,
    which should be defined on all 64-bit arches.

    Signed-off-by: Geert Uytterhoeven
    [ I think we should just make it "u64" on all architectures and get
    rid of the whole #ifdef CONFIG_xxBIT - Linus ]
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
    isdn: mISDN: socket: fix information leak to userland
    netdev: can: Change mail address of Hans J. Koch
    pcnet_cs: add new_id
    net: Truncate recvfrom and sendto length to INT_MAX.
    RDS: Let rds_message_alloc_sgs() return NULL
    RDS: Copy rds_iovecs into kernel memory instead of rereading from userspace
    RDS: Clean up error handling in rds_cmsg_rdma_args
    RDS: Return -EINVAL if rds_rdma_pages returns an error
    net: fix rds_iovec page count overflow
    can: pch_can: fix section mismatch warning by using a whitelisted name
    can: pch_can: fix sparse warning
    netxen_nic: Fix the tx queue manipulation bug in netxen_nic_probe
    ip_gre: fix fallback tunnel setup
    vmxnet: trivial annotation of protocol constant
    vmxnet3: remove unnecessary byteswapping in BAR writing macros
    ipv6/udp: report SndbufErrors and RcvbufErrors
    phy/marvell: rename 88ec048 to 88e1318s and fix mscr1 addr

    Linus Torvalds
     
  • The NFSv4 server was initializing the dp->dl_flock pointer by the
    somewhat ridiculous method of a locks_copy_lock callback.

    Now that setlease uses the passed-in lock instead of doing a copy,
    dl_flock no longer gets set, resulting in the lock leaking on delegation
    release, and later possible hangs (among other problems).

    So, initialize dl_flock and get rid of the callback.

    Signed-off-by: J. Bruce Fields
    Acked-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • We modified setlease to require the caller to allocate the new lease in
    the case of creating a new lease, but forgot to fix up the filesystem
    methods.

    Cc: Steven Whitehouse
    Cc: Steve French
    Cc: Trond Myklebust
    Signed-off-by: J. Bruce Fields
    Acked-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • We're depending on setlease to free the passed-in lease on failure.

    Signed-off-by: J. Bruce Fields
    Acked-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Removing a lock shouldn't require any allocations; a failure due to
    ENOMEM leaves the caller with a choice between retrying or giving up and
    leaking an unused lease.

    Next we should split the other lease calls into add and delete cases.
    I wanted to start with just the bugfix.

    Signed-off-by: J. Bruce Fields
    Acked-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • The input-large-scancode patches changed the binary search in
    drivers/media/IR/ir-keytable.c to use unsigned integers, but
    signed integers are actually necessary for the algorithm to work.

    Signed-off-by: David Härdeman
    Cc: Dmitry Torokhov
    Signed-off-by: Linus Torvalds

    David Härdeman
     
  • Structure mISDN_devinfo is copied to userland with the field "name"
    that has the last elements unitialized. It leads to leaking of
    contents of kernel stack memory.

    Signed-off-by: Vasiliy Kulikov
    Signed-off-by: David S. Miller

    Kulikov Vasiliy
     
  • My old mail address doesn't exist anymore. This changes all occurrences
    to my new address.

    Signed-off-by: Hans J. Koch
    Signed-off-by: David S. Miller

    Hans J. Koch
     
  • pcnet_cs:
    add new_id: "corega Ether CF-TD" 10Base-T PCMCIA card.

    Signed-off-by: Ken Kawasaki
    Signed-off-by: David S. Miller

    Ken Kawasaki
     
  • Signed-off-by: Linus Torvalds
    Signed-off-by: David S. Miller

    Linus Torvalds
     
  • Even with the previous fix, we still are reading the iovecs once
    to determine SGs needed, and then again later on. Preallocating
    space for sg lists as part of rds_message seemed like a good idea
    but it might be better to not do this. While working to redo that
    code, this patch attempts to protect against userspace rewriting
    the rds_iovec array between the first and second accesses.

    The consequences of this would be either a too-small or too-large
    sg list array. Too large is not an issue. This patch changes all
    callers of message_alloc_sgs to handle running out of preallocated
    sgs, and fail gracefully.

    Signed-off-by: Andy Grover
    Signed-off-by: David S. Miller

    Andy Grover
     
  • Change rds_rdma_pages to take a passed-in rds_iovec array instead
    of doing copy_from_user itself.

    Change rds_cmsg_rdma_args to copy rds_iovec array once only. This
    eliminates the possibility of userspace changing it after our
    sanity checks.

    Implement stack-based storage for small numbers of iovecs, based
    on net/socket.c, to save an alloc in the extremely common case.

    Although this patch reduces iovec copies in cmsg_rdma_args to 1,
    we still do another one in rds_rdma_extra_size. Getting rid of
    that one will be trickier, so it'll be a separate patch.

    Signed-off-by: Andy Grover
    Signed-off-by: David S. Miller

    Andy Grover
     
  • We don't need to set ret = 0 at the end -- it's initialized to 0.

    Also, don't increment s_send_rdma stat if we're exiting with an
    error.

    Signed-off-by: Andy Grover
    Signed-off-by: David S. Miller

    Andy Grover
     
  • rds_cmsg_rdma_args would still return success even if rds_rdma_pages
    returned an error (or overflowed).

    Signed-off-by: Andy Grover
    Signed-off-by: David S. Miller

    Andy Grover
     
  • As reported by Thomas Pollet, the rdma page counting can overflow. We
    get the rdma sizes in 64-bit unsigned entities, but then limit it to
    UINT_MAX bytes and shift them down to pages (so with a possible "+1" for
    an unaligned address).

    So each individual page count fits comfortably in an 'unsigned int' (not
    even close to overflowing into signed), but as they are added up, they
    might end up resulting in a signed return value. Which would be wrong.

    Catch the case of tot_pages turning negative, and return the appropriate
    error code.

    Reported-by: Thomas Pollet
    Signed-off-by: Linus Torvalds
    Signed-off-by: Andy Grover
    Signed-off-by: David S. Miller

    Linus Torvalds
     
  • This patch fixes the following section mismatch warning:

    WARNING: drivers/net/can/pch_can.o(.data+0x18):
    Section mismatch in reference from the variable pch_can_pcidev
    to the variable .devinit.rodata:pch_pci_tbl
    The variable pch_can_pcidev references
    the variable __devinitconst pch_pci_tbl

    This is actually a false positive which is fixed by giving the offending
    variable a whitelisted name, it's renamed to "pch_can_pci_driver".
    This makes sense because the variable is of the type "struct pci_driver".

    Signed-off-by: Marc Kleine-Budde
    Acked-by: Uwe Kleine-König
    Signed-off-by: David S. Miller

    Marc Kleine-Budde