Re: gcc-2.8.0 miscompiles kernel (Was: gcc-2.8 out...)

Dr Andrew C Aitchison (A.C.Aitchison@dpmms.cam.ac.uk)
Thu, 22 Jan 1998 13:00:57 +0000 (GMT)


(I'm not on linux-kernel, I'm an XFree86 developer who was pointed at
http://linux.wauug.org/hypermail/linux-kernel/1998week04 )

Florian Weimer <fw@cygnus.stuttgart.netsurf.de> suggested:
>
> asmlinkage int sys_iopl(long ebx,long ecx,long edx,
> long esi, long edi, long ebp, long eax, long ds,
> long es, long fs, long gs, long orig_eax,
> long eip,long cs,volatile long eflags,long esp,long ss)
> {
> unsigned int level = ebx;
>
> if (level > 3)
> return -EINVAL;
> if (!suser())
> return -EPERM;
> eflags = (eflags & 0xffffcfff) | (level << 12);
> return 0;
> }

If the original version of the function is like that it is definitely a
kernel problem. C is call be value, not call by reference (as used in
Fortran), so if we wish to permanently change the value of eflags we
should have been passed a pointer to eflags in the first place.

I haven't read the kernel code so there may be good reasons not to change
the api of this function, but using compiler bugs/hacks to fix a
fundamental violation of the C language is asking for big trouble.

Dr. Andrew C. Aitchison Computer Officer, DPMMS, Cambridge
A.C.Aitchison@dpmms.cam.ac.uk http://www.dpmms.cam.ac.uk/~werdna