lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46A8BBF2.5010406@zytor.com>
Date:	Thu, 26 Jul 2007 08:21:22 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Jian-Xin Lai <laijx03@...il.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: wrong constraints "=g" at include/asm-i386/string.h, line 186?

Jian-Xin Lai wrote:
> Hi,
> 
> The kernel version is 2.6.20.7. In include/asm-i386/string.h, line 169~185:
> static inline char * strrchr(const char * s, int c)
> {
> int d0, d1;
> register char * __res;
> __asm__ __volatile__(
>        "movb %%al,%%ah\n"
>        "1:\tlodsb\n\t"
>        "cmpb %%ah,%%al\n\t"
>        "jne 2f\n\t"
>        "leal -1(%%esi),%0\n"                                    (*)
>        "2:\ttestb %%al,%%al\n\t"
>        "jne 1b"
>        :"=g" (__res), "=&S" (d0), "=&a" (d1)               (**)
>        :"0" (0),"1" (s),"2" (c)
>        :"memory");
> return __res;
> }
> 
> The 'lea' instruction needs a register here (*), but "g" (**) means
> any registers, memory or immediate integer. Is it correct? If the
> compiler do not place the __res into a register, the compilation will
> fail. Should it be "r"?
> Thank you very much.
> 

Yes, it should be "r", and it looks like the author hacked around the
fact they had the wrong constraints by using the "register" keyword on
the variable declaration.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ