Re: [PATCH] [1/2] random: SMP locking

From: Zwane Mwaikambo (zwane@arm.linux.org.uk)
Date: Sat Aug 02 2003 - 07:35:22 EST


On Sat, 2 Aug 2003, Andrew Morton wrote:

> Oliver Xymoron <oxymoron@waste.org> wrote:
> >
> > This patch adds locking for SMP. Apparently Willy never managed to
> > revive his laptop with his version so I revived mine.
>
> hrm. I'm a random ignoramus. I'll look it over...
>
> Are you really sure that all the decisions about where to use spin_lock()
> vs spin_lock_irq() vs spin_lock_irqsave() are correct? They are
> non-obvious.
>
> > @@ -1619,18 +1660,23 @@
> > if (!capable(CAP_SYS_ADMIN))
> > return -EPERM;
> > p = (int *) arg;
> > + spin_lock(&random_state->lock);
> > ent_count = random_state->entropy_count;
> > if (put_user(ent_count, p++) ||
> > get_user(size, p) ||
> > put_user(random_state->poolinfo.poolwords, p++))
>
> Cannot perform userspace access while holding a lock - a pagefault could
> occur, perform IO, schedule away and the same CPU tries to take the same
> lock via a different process.

Perhaps might_sleep() in *_user, copy_* etc is in order?

-- 
function.linuxpower.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 07 2003 - 22:00:18 EST