31 Mar, 2011

1 commit


21 Feb, 2011

1 commit

  • At present, the comment header in random.c makes no mention of
    add_disk_randomness, and instead, suggests that disk activity adds to the
    random pool by way of add_interrupt_randomness, which appears to not have
    been the case since sometime prior to the existence of git, and even prior
    to bitkeeper. Didn't look any further back. At least, as far as I can
    tell, there are no storage drivers setting IRQF_SAMPLE_RANDOM, which is a
    requirement for add_interrupt_randomness to trigger, so the only way for a
    disk to contribute entropy is by way of add_disk_randomness. Update
    comments accordingly, complete with special mention about solid state
    drives being a crappy source of entropy (see e2e1a148bc for reference).

    Signed-off-by: Jarod Wilson
    Acked-by: Matt Mackall
    Signed-off-by: Herbert Xu

    Jarod Wilson
     

17 Dec, 2010

1 commit


15 Oct, 2010

1 commit

  • All file_operations should get a .llseek operation so we can make
    nonseekable_open the default for future file operations without a
    .llseek pointer.

    The three cases that we can automatically detect are no_llseek, seq_lseek
    and default_llseek. For cases where we can we can automatically prove that
    the file offset is always ignored, we use noop_llseek, which maintains
    the current behavior of not returning an error from a seek.

    New drivers should normally not use noop_llseek but instead use no_llseek
    and call nonseekable_open at open time. Existing drivers can be converted
    to do the same when the maintainer knows for certain that no user code
    relies on calling seek on the device file.

    The generated code is often incorrectly indented and right now contains
    comments that clarify for each added line why a specific variant was
    chosen. In the version that gets submitted upstream, the comments will
    be gone and I will manually fix the indentation, because there does not
    seem to be a way to do that using coccinelle.

    Some amount of new code is currently sitting in linux-next that should get
    the same modifications, which I will do at the end of the merge window.

    Many thanks to Julia Lawall for helping me learn to write a semantic
    patch that does all this.

    ===== begin semantic patch =====
    // This adds an llseek= method to all file operations,
    // as a preparation for making no_llseek the default.
    //
    // The rules are
    // - use no_llseek explicitly if we do nonseekable_open
    // - use seq_lseek for sequential files
    // - use default_llseek if we know we access f_pos
    // - use noop_llseek if we know we don't access f_pos,
    // but we still want to allow users to call lseek
    //
    @ open1 exists @
    identifier nested_open;
    @@
    nested_open(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ read disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {

    }

    @ read_no_fpos disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ write @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {

    }

    @ write_no_fpos @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ fops0 @
    identifier fops;
    @@
    struct file_operations fops = {
    ...
    };

    @ has_llseek depends on fops0 @
    identifier fops0.fops;
    identifier llseek_f;
    @@
    struct file_operations fops = {
    ...
    .llseek = llseek_f,
    ...
    };

    @ has_read depends on fops0 @
    identifier fops0.fops;
    identifier read_f;
    @@
    struct file_operations fops = {
    ...
    .read = read_f,
    ...
    };

    @ has_write depends on fops0 @
    identifier fops0.fops;
    identifier write_f;
    @@
    struct file_operations fops = {
    ...
    .write = write_f,
    ...
    };

    @ has_open depends on fops0 @
    identifier fops0.fops;
    identifier open_f;
    @@
    struct file_operations fops = {
    ...
    .open = open_f,
    ...
    };

    // use no_llseek if we call nonseekable_open
    ////////////////////////////////////////////
    @ nonseekable1 depends on !has_llseek && has_open @
    identifier fops0.fops;
    identifier nso ~= "nonseekable_open";
    @@
    struct file_operations fops = {
    ... .open = nso, ...
    +.llseek = no_llseek, /* nonseekable */
    };

    @ nonseekable2 depends on !has_llseek @
    identifier fops0.fops;
    identifier open.open_f;
    @@
    struct file_operations fops = {
    ... .open = open_f, ...
    +.llseek = no_llseek, /* open uses nonseekable */
    };

    // use seq_lseek for sequential files
    /////////////////////////////////////
    @ seq depends on !has_llseek @
    identifier fops0.fops;
    identifier sr ~= "seq_read";
    @@
    struct file_operations fops = {
    ... .read = sr, ...
    +.llseek = seq_lseek, /* we have seq_read */
    };

    // use default_llseek if there is a readdir
    ///////////////////////////////////////////
    @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier readdir_e;
    @@
    // any other fop is used that changes pos
    struct file_operations fops = {
    ... .readdir = readdir_e, ...
    +.llseek = default_llseek, /* readdir is present */
    };

    // use default_llseek if at least one of read/write touches f_pos
    /////////////////////////////////////////////////////////////////
    @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read.read_f;
    @@
    // read fops use offset
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = default_llseek, /* read accesses f_pos */
    };

    @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ... .write = write_f, ...
    + .llseek = default_llseek, /* write accesses f_pos */
    };

    // Use noop_llseek if neither read nor write accesses f_pos
    ///////////////////////////////////////////////////////////

    @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    identifier write_no_fpos.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ...
    .write = write_f,
    .read = read_f,
    ...
    +.llseek = noop_llseek, /* read and write both use no f_pos */
    };

    @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write_no_fpos.write_f;
    @@
    struct file_operations fops = {
    ... .write = write_f, ...
    +.llseek = noop_llseek, /* write uses no f_pos */
    };

    @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    @@
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = noop_llseek, /* read uses no f_pos */
    };

    @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    @@
    struct file_operations fops = {
    ...
    +.llseek = noop_llseek, /* no read or write fn */
    };
    ===== End semantic patch =====

    Signed-off-by: Arnd Bergmann
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     

31 Jul, 2010

1 commit


20 May, 2010

1 commit


04 Feb, 2010

1 commit


02 Feb, 2010

2 commits

  • The previous changeset left behind an unused inode variable.
    This patch removes it.

    Reported-by: Stephen Rothwell
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • No other driver does anything remotely like this that I know of except
    for the tty drivers, and I can't see any reason for random/urandom to do
    it. In fact, it's a (trivial, harmless) timing information leak. And
    obviously, it generates power- and flash-cycle wasting I/O, especially
    if combined with something like hwrngd. Also, it breaks ubifs's
    expectations.

    Signed-off-by: Matt Mackall
    Signed-off-by: Herbert Xu

    Matt Mackall
     

16 Dec, 2009

1 commit


19 Nov, 2009

1 commit


12 Nov, 2009

1 commit

  • Now that sys_sysctl is a wrapper around /proc/sys all of
    the binary sysctl support elsewhere in the tree is
    dead code.

    Cc: Jens Axboe
    Cc: Corey Minyard
    Cc: Greg Kroah-Hartman
    Cc: Matt Mackall
    Cc: Herbert Xu
    Cc: Neil Brown
    Cc: "James E.J. Bottomley"
    Acked-by: Clemens Ladisch for drivers/char/hpet.c
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     

24 Sep, 2009

1 commit

  • It's unused.

    It isn't needed -- read or write flag is already passed and sysctl
    shouldn't care about the rest.

    It _was_ used in two places at arch/frv for some reason.

    Signed-off-by: Alexey Dobriyan
    Cc: David Howells
    Cc: "Eric W. Biederman"
    Cc: Al Viro
    Cc: Ralf Baechle
    Cc: Martin Schwidefsky
    Cc: Ingo Molnar
    Cc: "David S. Miller"
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

18 Jun, 2009

1 commit

  • FIPS-140 requires that all random number generators implement continuous self
    tests in which each extracted block of data is compared against the last block
    for repetition. The ansi_cprng implements such a test, but it would be nice if
    the hw rng's did the same thing. Obviously its not something thats always
    needed, but it seems like it would be a nice feature to have on occasion. I've
    written the below patch which allows individual entropy stores to be flagged as
    desiring a continuous test to be run on them as is extracted. By default this
    option is off, but is enabled in the event that fips mode is selected during
    bootup.

    Signed-off-by: Neil Horman
    Acked-by: Matt Mackall
    Signed-off-by: Herbert Xu

    Neil Horman
     

20 May, 2009

1 commit

  • Martin Knoblauch reports that trying to build 2.6.30-rc6-git3 with
    RHEL4.3 userspace (gcc (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)) causes an
    internal compiler error (ICE):

    drivers/char/random.c: In function `get_random_int':
    drivers/char/random.c:1672: error: unrecognizable insn:
    (insn 202 148 150 0 /scratch/build/linux-2.6.30-rc6-git3/arch/x86/include/asm/tsc.h:23 (set (reg:SI 0 ax [91])
    (subreg:SI (plus:DI (plus:DI (reg:DI 0 ax [88])
    (subreg:DI (reg:SI 6 bp) 0))
    (const_int -4 [0xfffffffffffffffc])) 0)) -1 (nil)
    (nil))
    drivers/char/random.c:1672: internal compiler error: in extract_insn, at recog.c:2083

    and after some debugging it turns out that it's due to the code trying
    to figure out the rough value of the current stack pointer by taking an
    address of an uninitialized variable and casting that to an integer.

    This is clearly a compiler bug, but it's not worth fighting - while the
    current stack kernel pointer might be somewhat hard to predict in user
    space, it's also not generally going to change for a lot of the call
    chains for a particular process.

    So just drop it, and mumble some incoherent curses at the compiler.

    Tested-by: Martin Knoblauch
    Cc: Matt Mackall
    Cc: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

08 May, 2009

1 commit

  • It's a really simple patch that basically just open-codes the current
    "secure_ip_id()" call, but when open-coding it we now use a _static_
    hashing area, so that it gets updated every time.

    And to make sure somebody can't just start from the same original seed of
    all-zeroes, and then do the "half_md4_transform()" over and over until
    they get the same sequence as the kernel has, each iteration also mixes in
    the same old "current->pid + jiffies" we used - so we should now have a
    regular strong pseudo-number generator, but we also have one that doesn't
    have a single seed.

    Note: the "pid + jiffies" is just meant to be a tiny tiny bit of noise. It
    has no real meaning. It could be anything. I just picked the previous
    seed, it's just that now we keep the state in between calls and that will
    feed into the next result, and that should make all the difference.

    I made that hash be a per-cpu data just to avoid cache-line ping-pong:
    having multiple CPU's write to the same data would be fine for randomness,
    and add yet another layer of chaos to it, but since get_random_int() is
    supposed to be a fast interface I did it that way instead. I considered
    using "__raw_get_cpu_var()" to avoid any preemption overhead while still
    getting the hash be _mostly_ ping-pong free, but in the end good taste won
    out.

    Signed-off-by: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

03 Apr, 2009

1 commit


11 Jan, 2009

2 commits

  • Ingo Molnar wrote:
    >
    > tip/kernel/fork.c: In function 'copy_signal':
    > tip/kernel/fork.c:825: warning: unused variable 'ret'
    > tip/drivers/char/random.c: In function 'get_timer_rand_state':
    > tip/drivers/char/random.c:584: error: dereferencing pointer to incomplete type
    > tip/drivers/char/random.c: In function 'set_timer_rand_state':
    > tip/drivers/char/random.c:594: error: dereferencing pointer to incomplete type
    > make[3]: *** [drivers/char/random.o] Error 1

    irq_desc is defined in linux/irq.h, so include it in the genirq case.

    Signed-off-by: Yinghai Lu
    Signed-off-by: Ingo Molnar

    Yinghai Lu
     
  • Impact: clean up sparseirq fallout on random.c

    Ingo suggested to change some ifdef from SPARSE_IRQ to GENERIC_HARDIRQS
    so we could some #ifdef later if all arch support genirq

    Signed-off-by: Yinghai Lu
    Acked-by: Matt Mackall
    Signed-off-by: Ingo Molnar

    Yinghai Lu
     

07 Jan, 2009

1 commit

  • As a non-atomic value, it's only safe to look at entropy_count when the
    pool lock is held, so we move the BUG_ON inside the lock for correctness.

    Also remove the spurious comment. It's ok for entropy_count to
    temporarily exceed POOLBITS so long as it's left in a consistent state
    when the lock is released.

    This is a more correct, simple, and idiomatic fix for the bug in
    8b76f46a2db. I've left the reorderings introduced by that patch in place
    as they're harmless, even though they don't properly deal with potential
    atomicity issues.

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

    Matt Mackall
     

04 Jan, 2009

1 commit


08 Dec, 2008

1 commit

  • Impact: new feature

    Problem on distro kernels: irq_desc[NR_IRQS] takes megabytes of RAM with
    NR_CPUS set to large values. The goal is to be able to scale up to much
    larger NR_IRQS value without impacting the (important) common case.

    To solve this, we generalize irq_desc[NR_IRQS] to an (optional) array of
    irq_desc pointers.

    When CONFIG_SPARSE_IRQ=y is used, we use kzalloc_node to get irq_desc,
    this also makes the IRQ descriptors NUMA-local (to the site that calls
    request_irq()).

    This gets rid of the irq_cfg[] static array on x86 as well: irq_cfg now
    uses desc->chip_data for x86 to store irq_cfg.

    Signed-off-by: Yinghai Lu
    Signed-off-by: Ingo Molnar

    Yinghai Lu
     

02 Nov, 2008

1 commit

  • As it is, all instances of ->release() for files that have ->fasync()
    need to remember to evict file from fasync lists; forgetting that
    creates a hole and we actually have a bunch that *does* forget.

    So let's keep our lives simple - let __fput() check FASYNC in
    file->f_flags and call ->fasync() there if it's been set. And lose that
    crap in ->release() instances - leaving it there is still valid, but we
    don't have to bother anymore.

    Signed-off-by: Al Viro
    Signed-off-by: Linus Torvalds

    Al Viro
     

21 Oct, 2008

1 commit

  • …/git/tip/linux-2.6-tip

    This merges branches irq/genirq, irq/sparseirq-v4, timers/hpet-percpu
    and x86/uv.

    The sparseirq branch is just preliminary groundwork: no sparse IRQs are
    actually implemented by this tree anymore - just the new APIs are added
    while keeping the old way intact as well (the new APIs map 1:1 to
    irq_desc[]). The 'real' sparse IRQ support will then be a relatively
    small patch ontop of this - with a v2.6.29 merge target.

    * 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (178 commits)
    genirq: improve include files
    intr_remapping: fix typo
    io_apic: make irq_mis_count available on 64-bit too
    genirq: fix name space collisions of nr_irqs in arch/*
    genirq: fix name space collision of nr_irqs in autoprobe.c
    genirq: use iterators for irq_desc loops
    proc: fixup irq iterator
    genirq: add reverse iterator for irq_desc
    x86: move ack_bad_irq() to irq.c
    x86: unify show_interrupts() and proc helpers
    x86: cleanup show_interrupts
    genirq: cleanup the sparseirq modifications
    genirq: remove artifacts from sparseirq removal
    genirq: revert dynarray
    genirq: remove irq_to_desc_alloc
    genirq: remove sparse irq code
    genirq: use inline function for irq_to_desc
    genirq: consolidate nr_irqs and for_each_irq_desc()
    x86: remove sparse irq from Kconfig
    genirq: define nr_irqs for architectures with GENERIC_HARDIRQS=n
    ...

    Linus Torvalds
     

17 Oct, 2008

1 commit

  • name and nlen parameters passed to ->strategy hook are unused, remove
    them. In general ->strategy hook should know what it's doing, and don't
    do something tricky for which, say, pointer to original userspace array
    may be needed (name).

    Signed-off-by: Alexey Dobriyan
    Acked-by: David S. Miller [ networking bits ]
    Cc: Ralf Baechle
    Cc: David Howells
    Cc: Matt Mackall
    Cc: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

16 Oct, 2008

5 commits


09 Oct, 2008

1 commit

  • * Implement disk_devt() and part_devt() and use them to directly
    access devt instead of computing it from ->major and ->first_minor.

    Note that all references to ->major and ->first_minor outside of
    block layer is used to determine devt of the disk (the part0) and as
    ->major and ->first_minor will continue to represent devt for the
    disk, converting these users aren't strictly necessary. However,
    convert them for consistency.

    * Implement disk_max_parts() to avoid directly deferencing
    genhd->minors.

    * Update bdget_disk() such that it doesn't assume consecutive minor
    space.

    * Move devt computation from register_disk() to add_disk() and make it
    the only one (all other usages use the initially determined value).

    These changes clean up the code and will help disk->part dereference
    fix and extended block device numbers.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Tejun Heo
     

03 Sep, 2008

1 commit

  • Fix a bug reported by and diagnosed by Aaron Straus.

    This is a regression intruduced into 2.6.26 by

    commit adc782dae6c4c0f6fb679a48a544cfbcd79ae3dc
    Author: Matt Mackall
    Date: Tue Apr 29 01:03:07 2008 -0700

    random: simplify and rename credit_entropy_store

    credit_entropy_bits() does:

    spin_lock_irqsave(&r->lock, flags);
    ...
    if (r->entropy_count > r->poolinfo->POOLBITS)
    r->entropy_count = r->poolinfo->POOLBITS;

    so there is a time window in which this BUG_ON():

    static size_t account(struct entropy_store *r, size_t nbytes, int min,
    int reserved)
    {
    unsigned long flags;

    BUG_ON(r->entropy_count > r->poolinfo->POOLBITS);

    /* Hold lock while accounting */
    spin_lock_irqsave(&r->lock, flags);

    can trigger.

    We could fix this by moving the assertion inside the lock, but it seems
    safer and saner to revert to the old behaviour wherein
    entropy_store.entropy_count at no time exceeds
    entropy_store.poolinfo->POOLBITS.

    Reported-by: Aaron Straus
    Cc: Matt Mackall
    Cc: Theodore Ts'o
    Cc: [2.6.26.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

19 Aug, 2008

1 commit


25 Jul, 2008

1 commit

  • On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
    boundary. For example:

    u64 val = PAGE_ALIGN(size);

    always returns a value < 4GB even if size is greater than 4GB.

    The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
    example):

    #define PAGE_SHIFT 12
    #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
    #define PAGE_MASK (~(PAGE_SIZE-1))
    ...
    #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)

    The "~" is performed on a 32-bit value, so everything in "and" with
    PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
    Using the ALIGN() macro seems to be the right way, because it uses
    typeof(addr) for the mask.

    Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
    include/linux/mm.h.

    See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

    [akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
    [akpm@linux-foundation.org: fix v850]
    [akpm@linux-foundation.org: fix powerpc]
    [akpm@linux-foundation.org: fix arm]
    [akpm@linux-foundation.org: fix mips]
    [akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
    [akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
    [akpm@linux-foundation.org: fix powerpc]
    Signed-off-by: Andrea Righi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrea Righi
     

29 Apr, 2008

6 commits

  • Add async notification support to /dev/random.

    A little test case is below. Without this patch, you get:

    $ ./async-random
    Drained the pool
    Found more randomness

    With it, you get:

    $ ./async-random
    Drained the pool
    SIGIO
    Found more randomness

    #include
    #include
    #include
    #include
    #include

    static void handler(int sig)
    {
    printf("SIGIO\n");
    }

    int main(int argc, char **argv)
    {
    int fd, n, err, flags;

    if(signal(SIGIO, handler) < 0){
    perror("setting SIGIO handler");
    exit(1);
    }

    fd = open("/dev/random", O_RDONLY);
    if(fd < 0){
    perror("open");
    exit(1);
    }

    flags = fcntl(fd, F_GETFL);
    if (flags < 0){
    perror("getting flags");
    exit(1);
    }

    flags |= O_NONBLOCK;
    if (fcntl(fd, F_SETFL, flags) < 0){
    perror("setting flags");
    exit(1);
    }

    while((err = read(fd, &n, sizeof(n))) > 0) ;

    if(err == 0){
    printf("random returned 0\n");
    exit(1);
    }
    else if(errno != EAGAIN){
    perror("read");
    exit(1);
    }

    flags |= O_ASYNC;
    if (fcntl(fd, F_SETFL, flags) < 0){
    perror("setting flags");
    exit(1);
    }

    if (fcntl(fd, F_SETOWN, getpid()) < 0) {
    perror("Setting SIGIO");
    exit(1);
    }

    printf("Drained the pool\n");
    read(fd, &n, sizeof(n));
    printf("Found more randomness\n");

    return(0);
    }

    Signed-off-by: Jeff Dike
    Signed-off-by: Matt Mackall
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • - emphasize bits in the name
    - make zero bits lock-free
    - simplify logic

    Signed-off-by: Matt Mackall
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matt Mackall
     
  • Switch add_entropy_words to a byte-oriented interface, eliminating numerous
    casts and byte/word size rounding issues. This also reduces the overall
    bit/byte/word confusion in this code.

    We now mix a byte at a time into the word-based pool. This takes four times
    as many iterations, but should be negligible compared to hashing overhead.
    This also increases our pool churn, which adds some depth against some
    theoretical failure modes.

    The function name is changed to emphasize pool mixing and deemphasize entropy
    (the samples mixed in may not contain any). extract is added to the core
    function to make it clear that it extracts from the pool.

    Signed-off-by: Matt Mackall
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matt Mackall
     
  • The add_ptr variable wasn't used in a sensible way, use only i instead.
    i got reused later for a different purpose, use j instead.

    While we're here, put tap0 first in the tap list and add a comment.

    Signed-off-by: Matt Mackall
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matt Mackall
     
  • The urandom output pool (ie the fast path) fits in one cacheline, so
    this is pretty unnecessary. Further, the output path has already
    fetched the entire pool to hash it before calling in here.

    (This was the only user of prefetch_range in the kernel, and it passed
    in words rather than bytes!)

    Signed-off-by: Matt Mackall
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matt Mackall
     
  • - eliminate new_rotate
    - move input_rotate masking
    - simplify input_rotate update
    - move input_rotate update to end of inner loop for readability

    Signed-off-by: Matt Mackall
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matt Mackall