Re: [patch 6/12] hold atomic kmaps across generic_file_read

Linus Torvalds
2002-08-12T17:24:27Z

On Mon, 12 Aug 2002, Rusty Russell wrote:
> On Fri, 9 Aug 2002 18:33:09 -0700 (PDT)
> Linus Torvalds <torvalds@transmeta.com> wrote:
>
> > repeat:
> > kmap_atomic(..); // this increments preempt count
> > nr = copy_from_user(..);
>
> Please please please use a different name for "I know I'm not preemptible but
> I can handle it" or a flag or something.
>
> That leaves us with the possibility of a BUG() in the "normal" copy_to/from_user
> for all those "I'm holding a spinlock while copying to userspace wheeee!" bugs.
> Very common mistake for new kernel authors.

Agreed.

Maybe the right thing to do is to just have a

atomic_copy_from_user()

which can then be used to explicitly not check if we have a kernel
debugging option.

Linus