linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* copy_from_user broken on i386 since 2.5.57
@ 2003-01-22 18:31 Brice Goglin
  2003-01-22 18:49 ` Andrew Morton
  2003-01-22 18:50 ` Sam Ravnborg
  0 siblings, 2 replies; 5+ messages in thread
From: Brice Goglin @ 2003-01-22 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: tigran, davej, hpa, akpm

Hi,

Trying to compile a very very simple module for 2.5,
I got an error from gcc saying that assembly code
is incorrect.
This problem appeared in 2.5.57 and is still here
in 2.5.59.
I only tried on i386.

Here's a very simple example code :

#define __KERNEL__
#define MODULE
#include "linux/module.h"
#include "asm/uaccess.h"

int func(void *to, const void *from) {
  return __copy_from_user(to, from, 1);
}


Here's gcc report :

mp760:~/tmp% gcc user.c -c -o user.o -Ipath_to_2.5.57/include
/tmp/cceAbcRd.s: Assembler messages:
/tmp/cceAbcRd.s:120: Error: `%al' not allowed with `movl'
/tmp/cceAbcRd.s:124: Error: `%al' not allowed with `xorl'
/tmp/cceAbcRd.s:209: Warning: using `%eax' instead of `%ax' due to `l' suffix
/tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to `l' suffix
/tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to `l' suffix


Regards

Brice Goglin
============
Ph.D Student
Laboratoire de l'Informatique et du Parallélisme
ENS Lyon
France

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: copy_from_user broken on i386 since 2.5.57
  2003-01-22 18:31 copy_from_user broken on i386 since 2.5.57 Brice Goglin
@ 2003-01-22 18:49 ` Andrew Morton
  2003-01-23 23:22   ` Bill Davidsen
       [not found]   ` <Pine.LNX.3.96.1030123182133.9688A-100000@gatekeeper.tmr.co m>
  2003-01-22 18:50 ` Sam Ravnborg
  1 sibling, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2003-01-22 18:49 UTC (permalink / raw)
  To: Brice Goglin; +Cc: linux-kernel, tigran, davej, hpa

Brice Goglin <bgoglin@ens-lyon.fr> wrote:
>
> Hi,
> 
> Trying to compile a very very simple module for 2.5,
> I got an error from gcc saying that assembly code
> is incorrect.
> This problem appeared in 2.5.57 and is still here
> in 2.5.59.
> I only tried on i386.
> 
> Here's a very simple example code :
> 
> #define __KERNEL__
> #define MODULE
> #include "linux/module.h"
> #include "asm/uaccess.h"
> 
> int func(void *to, const void *from) {
>   return __copy_from_user(to, from, 1);
> }
> 
> 
> Here's gcc report :
> 
> mp760:~/tmp% gcc user.c -c -o user.o -Ipath_to_2.5.57/include
> /tmp/cceAbcRd.s: Assembler messages:
> /tmp/cceAbcRd.s:120: Error: `%al' not allowed with `movl'
> /tmp/cceAbcRd.s:124: Error: `%al' not allowed with `xorl'
> /tmp/cceAbcRd.s:209: Warning: using `%eax' instead of `%ax' due to `l' suffix
> /tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to `l' suffix
> /tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to `l' suffix

Add `-O2' to the compiler switches.

No, I don't know either ;)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: copy_from_user broken on i386 since 2.5.57
  2003-01-22 18:31 copy_from_user broken on i386 since 2.5.57 Brice Goglin
  2003-01-22 18:49 ` Andrew Morton
@ 2003-01-22 18:50 ` Sam Ravnborg
  1 sibling, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2003-01-22 18:50 UTC (permalink / raw)
  To: Brice Goglin; +Cc: linux-kernel, tigran, davej, hpa, akpm

On Wed, Jan 22, 2003 at 07:31:48PM +0100, Brice Goglin wrote:
> Hi,
> 
> Trying to compile a very very simple module for 2.5,
> I got an error from gcc saying that assembly code
> is incorrect.
[snip]
> 
> Here's gcc report :
> 
> mp760:~/tmp% gcc user.c -c -o user.o -Ipath_to_2.5.57/include

Use:
make -C path/to/kernel/src SUBDIRS=$PWD modules

The way you specify is broken with recent kernels.
Btw. do not define __KERNEL__ and MODULE, thats already done,
when compiling a module like this.

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: copy_from_user broken on i386 since 2.5.57
  2003-01-22 18:49 ` Andrew Morton
@ 2003-01-23 23:22   ` Bill Davidsen
       [not found]   ` <Pine.LNX.3.96.1030123182133.9688A-100000@gatekeeper.tmr.co m>
  1 sibling, 0 replies; 5+ messages in thread
From: Bill Davidsen @ 2003-01-23 23:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Brice Goglin, Linux Kernel Mailing List

On Wed, 22 Jan 2003, Andrew Morton wrote:

> Brice Goglin <bgoglin@ens-lyon.fr> wrote:
> >
> > Hi,
> > 
> > Trying to compile a very very simple module for 2.5,
> > I got an error from gcc saying that assembly code
> > is incorrect.
> > This problem appeared in 2.5.57 and is still here
> > in 2.5.59.
> > I only tried on i386.
> > 
> > Here's a very simple example code :
> > 
> > #define __KERNEL__
> > #define MODULE
> > #include "linux/module.h"
> > #include "asm/uaccess.h"
> > 
> > int func(void *to, const void *from) {
> >   return __copy_from_user(to, from, 1);
> > }
> > 
> > 
> > Here's gcc report :
> > 
> > mp760:~/tmp% gcc user.c -c -o user.o -Ipath_to_2.5.57/include
> > /tmp/cceAbcRd.s: Assembler messages:
> > /tmp/cceAbcRd.s:120: Error: `%al' not allowed with `movl'
> > /tmp/cceAbcRd.s:124: Error: `%al' not allowed with `xorl'
> > /tmp/cceAbcRd.s:209: Warning: using `%eax' instead of `%ax' due to `l' suffix
> > /tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to `l' suffix
> > /tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to `l' suffix
> 
> Add `-O2' to the compiler switches.
> 
> No, I don't know either ;)

So, does this actually fix the problem or simply optimize the suspect code
out of existance until some later date?

-- 
bill davidsen <davidsen@tmr.com>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: copy_from_user broken on i386 since 2.5.57
       [not found]   ` <Pine.LNX.3.96.1030123182133.9688A-100000@gatekeeper.tmr.co m>
@ 2003-01-24  3:35     ` Mike Galbraith
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Galbraith @ 2003-01-24  3:35 UTC (permalink / raw)
  To: Bill Davidsen, Andrew Morton; +Cc: Brice Goglin, Linux Kernel Mailing List

At 06:22 PM 1/23/2003 -0500, Bill Davidsen wrote:
>On Wed, 22 Jan 2003, Andrew Morton wrote:
>
> > Brice Goglin <bgoglin@ens-lyon.fr> wrote:
> > >
> > > Hi,
> > >
> > > Trying to compile a very very simple module for 2.5,
> > > I got an error from gcc saying that assembly code
> > > is incorrect.
> > > This problem appeared in 2.5.57 and is still here
> > > in 2.5.59.
> > > I only tried on i386.
> > >
> > > Here's a very simple example code :
> > >
> > > #define __KERNEL__
> > > #define MODULE
> > > #include "linux/module.h"
> > > #include "asm/uaccess.h"
> > >
> > > int func(void *to, const void *from) {
> > >   return __copy_from_user(to, from, 1);
> > > }
> > >
> > >
> > > Here's gcc report :
> > >
> > > mp760:~/tmp% gcc user.c -c -o user.o -Ipath_to_2.5.57/include
> > > /tmp/cceAbcRd.s: Assembler messages:
> > > /tmp/cceAbcRd.s:120: Error: `%al' not allowed with `movl'
> > > /tmp/cceAbcRd.s:124: Error: `%al' not allowed with `xorl'
> > > /tmp/cceAbcRd.s:209: Warning: using `%eax' instead of `%ax' due to 
> `l' suffix
> > > /tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to 
> `l' suffix
> > > /tmp/cceAbcRd.s:213: Warning: using `%eax' instead of `%ax' due to 
> `l' suffix
> >
> > Add `-O2' to the compiler switches.
> >
> > No, I don't know either ;)
>
>So, does this actually fix the problem or simply optimize the suspect code
>out of existance until some later date?

Compiler bug?  With -O2, gcc-2.95.3 emits movb and xorb at the same spot.

gcc-3.2.1 doesn't have a problem with that code optimized or not... it flat 
refuses to suck up any inline assembly unless you use at least -O 
-finline-limit=1580.  (why 1580?)

         -Mike


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-01-24  3:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22 18:31 copy_from_user broken on i386 since 2.5.57 Brice Goglin
2003-01-22 18:49 ` Andrew Morton
2003-01-23 23:22   ` Bill Davidsen
     [not found]   ` <Pine.LNX.3.96.1030123182133.9688A-100000@gatekeeper.tmr.co m>
2003-01-24  3:35     ` Mike Galbraith
2003-01-22 18:50 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).