09 Jan, 2006

40 commits

  • We've had two instances recently of overflows when doing

    64_bit_value = (32_bit_value << PAGE_CACHE_SHIFT)

    I did a tree-wide grep of `<page_base)

    Cc: Oleg Drokin
    Cc: David Howells
    Cc: David Woodhouse
    Cc:
    Cc: Christoph Hellwig
    Cc: Anton Altaparmakov
    Cc: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Cc: Roman Zippel
    Cc:
    Cc: Miklos Szeredi
    Cc: Russell King
    Cc: Trond Myklebust
    Cc: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • __create_workqueue() not checking return of alloc_percpu()

    NULL dereference was possible.

    Signed-off-by: Ben Collins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ben Collins
     
  • Sent by Paul Clements , who needs to read
    Documentation/SubmittingPatches..

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    taneli.vahakangas@netsonic.fi
     
  • HDIO_GETGEO is implemented in most block drivers, and all of them have to
    duplicate the code to copy the structure to userspace, as well as getting
    the start sector. This patch moves that to common code [1] and adds a
    ->getgeo method to fill out the raw kernel hd_geometry structure. For many
    drivers this means ->ioctl can go away now.

    [1] the s390 block drivers are odd in this respect. xpram sets ->start
    to 4 always which seems more than odd, and the dasd driver shifts
    the start offset around, probably because of it's non-standard
    sector size.

    Signed-off-by: Christoph Hellwig
    Cc: Jens Axboe
    Cc:
    Cc: Jeff Dike
    Cc: Paolo Giarrusso
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Neil Brown
    Cc: Markus Lidel
    Cc: Russell King
    Cc: David Woodhouse
    Cc: Martin Schwidefsky
    Cc: James Bottomley
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xose Vazquez Perez
     
  • While rooting aroung in the signal code trying to understand how to fix the
    SIG_IGN ploy (set sig handler to SIG_IGN and flood system with high speed
    repeating timers) I came across what, I think, is a problem in sigaction()
    in that when processing a SIG_IGN request it flushes signals from 1 to
    SIGRTMIN and leaves the rest. Attempt to fix this.

    Signed-off-by: George Anzinger
    Cc: Roland McGrath
    Cc: Linus Torvalds
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    George Anzinger
     
  • Make it possible for a running process (such as gssapid) to be able to
    instantiate a key, as was requested by Trond Myklebust for NFS4.

    The patch makes the following changes:

    (1) A new, optional key type method has been added. This permits a key type
    to intercept requests at the point /sbin/request-key is about to be
    spawned and do something else with them - passing them over the
    rpc_pipefs files or netlink sockets for instance.

    The uninstantiated key, the authorisation key and the intended operation
    name are passed to the method.

    (2) The callout_info is no longer passed as an argument to /sbin/request-key
    to prevent unauthorised viewing of this data using ps or by looking in
    /proc/pid/cmdline.

    This means that the old /sbin/request-key program will not work with the
    patched kernel as it will expect to see an extra argument that is no
    longer there.

    A revised keyutils package will be made available tomorrow.

    (3) The callout_info is now attached to the authorisation key. Reading this
    key will retrieve the information.

    (4) A new field has been added to the task_struct. This holds the
    authorisation key currently active for a thread. Searches now look here
    for the caller's set of keys rather than looking for an auth key in the
    lowest level of the session keyring.

    This permits a thread to be servicing multiple requests at once and to
    switch between them. Note that this is per-thread, not per-process, and
    so is usable in multithreaded programs.

    The setting of this field is inherited across fork and exec.

    (5) A new keyctl function (KEYCTL_ASSUME_AUTHORITY) has been added that
    permits a thread to assume the authority to deal with an uninstantiated
    key. Assumption is only permitted if the authorisation key associated
    with the uninstantiated key is somewhere in the thread's keyrings.

    This function can also clear the assumption.

    (6) A new magic key specifier has been added to refer to the currently
    assumed authorisation key (KEY_SPEC_REQKEY_AUTH_KEY).

    (7) Instantiation will only proceed if the appropriate authorisation key is
    assumed first. The assumed authorisation key is discarded if
    instantiation is successful.

    (8) key_validate() is moved from the file of request_key functions to the
    file of permissions functions.

    (9) The documentation is updated.

    From:

    Build fix.

    Signed-off-by: David Howells
    Cc: Trond Myklebust
    Cc: Alexander Zangerl
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Cause any links within a keyring to keys that match a key to be linked into
    that keyring to be discarded as a link to the new key is added. The match is
    contingent on the type and description strings being the same.

    This permits requests, adds and searches to displace negative, expired,
    revoked and dead keys easily. After some discussion it was concluded that
    duplicate valid keys should probably be discarded also as they would otherwise
    hide the new key.

    Since request_key() is intended to be the primary method by which keys are
    added to a keyring, duplicate valid keys wouldn't be an issue there as that
    function would return an existing match in preference to creating a new key.

    Signed-off-by: David Howells
    Cc: Trond Myklebust
    Cc: Alexander Zangerl
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Add a new keyctl function that allows the expiry time to be set on a key or
    removed from a key, provided the caller has attribute modification access.

    Signed-off-by: David Howells
    Cc: Trond Myklebust
    Cc: Alexander Zangerl
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • kmsg_write returns with printk, so some programs may be confused by a
    successful write() with a return value different than the buffer length.

    # /bin/echo something > /dev/kmsg
    /bin/echo: write error: Inappropriate ioctl for device

    The drawbacks is that the printk return value can no more be quickly
    checked from userspace.

    Signed-off-by: Guillaume Chazarain
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Guillaume Chazarain
     
  • What's the true meaning of the printk return value? Should it include the
    priority prefix length of 3? and what about the timing information? In
    both cases it was broken:

    strace -e write echo 1 > /dev/kmsg
    => write(1, "1\n", 2) = 5
    strace -e write echo "1" > /dev/kmsg
    => write(1, "1\n", 5) = 8

    The returned length was "length of input string + 3", I made it "length
    of string output to the log buffer".

    Note that I couldn't find any printk caller in the kernel interested by its
    return value besides kmsg_write.

    Signed-off-by: Guillaume Chazarain
    Acked-By: Tim Bird
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Guillaume Chazarain
     
  • When making an fctl locking call through compat_sys_fcntl64 (i.e. a 32bit
    app on a 64bit kernel), the syscall can return a locking range that is in
    conflict with the queried lock.

    If some aspect of this range does not fit in the 32bit structure, something
    needs to be done.

    The current code is wrong in several respects:

    - It returns data to userspace even if no conflict was found
    i.e. it should check l_type for F_UNLCK
    - It returns -EOVERFLOW too agressively. A lock range covering
    the last possible byte of the file (start = COMPAT_OFF_T_MAX,
    len = 1) should be possible, but is rejected with the current test.
    - A extra-long 'len' should not be a problem. If only that part
    of the conflicting lock that would be visible to the 32bit
    app needs to be reported to the 32bit app anyway.

    This patch addresses those three issues and adds a comment to (hopefully)
    record it for posterity.

    Note: this patch mainly affects test-cases. Real applications rarely is
    ever see the problems.

    This patch has been tested (LSB test suite), and works.

    Signed-off-by: Neil Brown
    Cc: Arnd Bergmann
    Cc: Christoph Hellwig
    Cc: Matthew Wilcox
    Cc: Trond Myklebust
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    NeilBrown
     
  • SUS requires that when truncating a file to the size that it currently
    is:
    truncate and ftruncate should NOT modify ctime or mtime
    O_TRUNC SHOULD modify ctime and mtime.

    Currently mtime and ctime are always modified on most local
    filesystems (side effect of ->truncate) or never modified (on NFS).

    With this patch:
    ATTR_CTIME|ATTR_MTIME are sent with ATTR_SIZE precisely when
    an update of these times is required whether size changes or not
    (via a new argument to do_truncate). This allows NFS to do
    the right thing for O_TRUNC.
    inode_setattr nolonger forces ATTR_MTIME|ATTR_CTIME when the ATTR_SIZE
    sets the size to it's current value. This allows local filesystems
    to do the right thing for f?truncate.

    Also, the logic in inode_setattr is changed a bit so there are two return
    points. One returns the error from vmtruncate if it failed, the other
    returns 0 (there can be no other failure).

    Finally, if vmtruncate succeeds, and ATTR_SIZE is the only change
    requested, we now fall-through and mark_inode_dirty. If a filesystem did
    not have a ->truncate function, then vmtruncate will have changed i_size,
    without marking the inode as 'dirty', and I think this is wrong.

    Signed-off-by: Neil Brown
    Cc: Christoph Hellwig
    Cc: Trond Myklebust
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    NeilBrown
     
  • Make it possible to include linux/pagevec.h multiple times without
    incurring errors due to duplicate definitions.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Reported from Redhat Bugzilla Bug 170450

    "I updated to the development kernel and now during boot only the top of the
    text is visable. For example the monitor screen the is the lines and I can
    only see text in the asterisk area.

    Antonino A. Daplas
     
  • When doublescan mode is in use, scanlines must be doubled.

    Thanks to Jason Dravet for reporting and testing.

    Signed-off-by: Samuel Thibault
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Samuel Thibault
     
  • inode can never be NULL when calling this function.

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

    Christoph Hellwig
     
  • The ptrace_get_task_struct() helper that I added as part of the ptrace
    consolidation is useful in variety of places that currently opencode it.
    Switch them to the common helpers.

    Add a ptrace_traceme() helper that needs to be explicitly called, and simplify
    the ptrace_get_task_struct() interface. We don't need the request argument
    now, and we return the task_struct directly, using ERR_PTR() for error
    returns. It's a bit more code in the callers, but we have two sane routines
    that do one thing well now.

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

    Christoph Hellwig
     
  • librelay and relay-app.h have been retired - update Documentation to reflect
    that.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • This patch renames relayfs_file_operations to relay_file_operations, and the
    file operations themselves from relayfs_XXX to relay_file_XXX, to make it more
    clear that they refer to relay files.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • Documentation update for creating global buffers.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • This patch adds the optional is_global outparam to the create_buf_file()
    callback. This can be used by clients to create a single global relayfs
    buffer instead of the default per-cpu buffers. This was suggested as being
    useful for certain debugging applications where it's more convenient to be
    able to get all the data from a single channel without having to go to the
    bother of dealing with per-cpu files.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • Documentation update for creating relay files in other filesystems.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • This patch adds a couple of callback functions that allow a client to hook
    into relay_open()/close() and supply the files that will be used to represent
    the channel buffers; the default implementation if no callbacks are defined is
    to create the files in relayfs. This is to support the creation and use of
    relay files in other filesystems such as debugfs, as implied by the fact that
    relayfs_file_operations are exported.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • Documentation update for non-relay files.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • Since we're no longer using relayfs_inode_info, remove relayfs_alloc_inode()
    and relayfs_destroy_inode() along with the relayfs inode cache.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • Use inode->u.generic_ip instead of relayfs_inode_info to store pointer to user
    data. Clients using relayfs_file_create() to create their own files would
    probably more expect their data to be stored in generic_ip; we also intend in
    the next set of patches to get rid of relayfs-specific stuff in the file
    operations, so we might as well do it here.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • This patch adds and exports relayfs_remove_file(), for API symmetry (with
    relayfs_create_file()).

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • This patch adds a mandatory fileops param to relayfs_create_file() and exports
    that function so that clients can use it to create files defined by their own
    set of file operations, in relayfs. The purpose is to allow relayfs
    applications to create their own set of 'control' files alongside their relay
    files in relayfs rather than having to create them in /proc or debugfs for
    instance. relayfs_create_file() is also used by relay_open_buf() to create
    the relay files for a channel. In this case, a pointer to
    relayfs_file_operations is passed in, along with a pointer to the buffer
    associated with the file.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • The patch series implementa or fixes 3 things that were specifically requested
    or suggested by relayfs users:

    - support for non-relay files (patches 1-6)

    Currently, the relayfs API only supports the creation of directories
    (relayfs_create_dir()) and relay files (relay_open()). These patches adds
    support for non-relay files (relayfs_create_file()). This is so relayfs
    applications can create 'control files' in relayfs itself rather than in /proc
    or via a netlink channel, as is currently done in the relay-app examples.
    Basically what this amounts to is exporting relayfs_create_file() with an
    additional file_ops param that clients can use to supply file operations for
    their own special-purpose files in relayfs.

    - make exported relay file ops useful (patches 7-8)

    The relayfs relay_file_operations have always been exported, the intent being
    to make it possible to create relay files in other filesystems such as
    debugfs. The problem, though, is that currently the file operations are too
    tightly coupled to relayfs to actually be used for this purpose. This patch
    fixes that by adding a couple of callback functions that allow a client to
    hook into relay_open()/close() and supply the files that will be used to
    represent the channel buffers; the default implementation if no callbacks are
    defined is to create the files in relayfs.

    - add an option to create global relay buffer (patches 9-10) The file creation
    callback also supplies an optional param, is_global, that can be used by
    clients to create a single global relayfs buffer instead of the default
    per-cpu buffers. This was suggested as being useful for certain debugging
    applications where it's more convenient to be able to get all the data from a
    single channel without having to go to the bother of dealing with per-cpu
    files.

    - cleanup, some renaming and Documentation updates (patches 11-12)

    There were several comments that the use of netlink in the example code was
    non-intuitive and in fact the whole relay-app business was needlessly
    confusing. Based on that feedback, the example code has been completely
    converted over to relayfs control files as supported by this patch, and have
    also been made completely self-contained.

    The converted examples along with a couple of new examples that demonstrate
    using exported relay files can be found in relay-apps tarball:
    http://prdownloads.sourceforge.net/relayfs/relay-apps-0.9.tar.gz?download

    This patch:

    Separate buffer create/destroy from inode create/destroy. We want to be able
    to associate other data and not just relay buffers with inodes. Buffer
    create/destroy is moved out of inode.c and into relayfs core code.

    Signed-off-by: Tom Zanussi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tom Zanussi
     
  • Unobfsucate this struct member

    Cc: Manfred Spraul
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Needed for the Novell kernel debugger and perhaps some per-cpu data on x86_64
    in the future.

    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Beulich
     
  • Use atomic_inc_not_zero for rcu files instead of special case rcuref.

    Signed-off-by: Nick Piggin
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     
  • Convert atomic_dec_and_lock to use new atomic primitives.

    Signed-off-by: Nick Piggin
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     
  • Use bd_claim() when opening the cdrom device to prevent user space programs
    such as cdrecord, hald and kded from interfering with the burning process.

    Signed-off-by: Peter Osterlund
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Osterlund
     
  • This patch contains the following cleanups:
    - make needlessly global functions static
    - every file should include the headers containing the prototypes for
    it's global functions

    Signed-off-by: Adrian Bunk
    Acked-by: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • "extern inline" -> "static inline"

    Since there's no pullphone() function this patch removes the dead
    prototype.

    Signed-off-by: Adrian Bunk
    Acked-by: Karsten Keil
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch moves the rtc_interrupt() prototype to rtc.h and removes the
    prototypes from C files.

    It also renames static rtc_interrupt() functions in
    arch/arm/mach-integrator/time.c and arch/sh64/kernel/time.c to avoid compile
    problems.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Paul Gortmaker
    Acked-by: Paul Mundt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch add EXPORT_SYMBOL(filemap_write_and_wait) and use it.

    See mm/filemap.c:

    And changes the filemap_write_and_wait() and filemap_write_and_wait_range().

    Current filemap_write_and_wait() doesn't wait if filemap_fdatawrite()
    returns error. However, even if filemap_fdatawrite() returned an
    error, it may have submitted the partially data pages to the device.
    (e.g. in the case of -ENOSPC)

    Andrew Morton writes,

    If filemap_fdatawrite() returns an error, this might be due to some
    I/O problem: dead disk, unplugged cable, etc. Given the generally
    crappy quality of the kernel's handling of such exceptions, there's a
    good chance that the filemap_fdatawait() will get stuck in D state
    forever.

    So, this patch doesn't wait if filemap_fdatawrite() returns the -EIO.

    Trond, could you please review the nfs part? Especially I'm not sure,
    nfs must use the "filemap_fdatawrite(inode->i_mapping) == 0", or not.

    Acked-by: Trond Myklebust
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • This patch changes generic_cont_expand(), in order to share the code
    with fatfs.

    - Use vmtruncate() if ->prepare_write() returns a error.

    Even if ->prepare_write() returns an error, it may already have added some
    blocks. So, this truncates blocks outside of ->i_size by vmtruncate().

    - Add generic_cont_expand_simple().

    The generic_cont_expand_simple() assumes that ->prepare_write() can handle
    the block boundary. With this, we don't need to care the extra byte.

    And for expanding a file size by truncate(), fatfs uses the
    added generic_cont_expand_simple().

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi