Subject: Re: illegal instructions / irqs disabled warning

From: Johannes Berg <[email-masked]>
Date: Wed, 14 Dec 2005 15:49:33 +0100

On Wed, 2005-12-14 at 08:41 -0600, Kumar Gala wrote:

> Its highly likely, but not guaranteed on all systems.  In truth this  
> is most likely a bug.

Ok.

> > But here's the actual question:
> > static inline unsigned long __copy_from_user(void *to,
> >                 const void __user *from, unsigned long size)
> > {
> >         might_sleep();
> >         return __copy_from_user_inatomic(to, from, size);
> > }
> >
> > Does that mean __copy_from_user_inatomic isn't actually valid to  
> > call in
> > atomic context? Or is this only so that kernel developers that use
> > powerpc see the bugs their code would have on other platforms? The  
> > magic
> > in get_user_asm thoroughly confuses me.
> 
> What do you mean atomic context?  Not exactly sure what your asking  
> about.

Well, the above code loading the instruction that faulted is called from
the interrupt context where the kernel tries to fix it up. If that
instruction is not in memory for whatever reason, then it shouldn't try
to fix it up bug kill the program with SIGILL or SIGSEGV or whatever...
This is what I came from, and tried looking into how to implement that.
But then I ran across the code in __copy_from_user which just calls
__copy_from_user_inatomic so I'm wondering if it is actually possible to
safely copy data (the instruction) from user space in an interrupt.

Thanks,
johannes