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: <1739960e-7f95-88ef-9b91-31c7504bb7fd@huawei.com>
Date:   Fri, 16 Dec 2022 21:31:04 +0800
From:   "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>
To:     Andreas Schwab <schwab@...ux-m68k.org>
CC:     Geert Uytterhoeven <geert@...ux-m68k.org>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        Jiri Kosina <jikos@...nel.org>,
        Miroslav Benes <mbenes@...e.cz>,
        Petr Mladek <pmladek@...e.com>,
        Joe Lawrence <joe.lawrence@...hat.com>,
        <live-patching@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Jiri Olsa <jolsa@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Luis Chamberlain <mcgrof@...nel.org>,
        <linux-modules@...r.kernel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>,
        David Laight <David.Laight@...lab.com>,
        linux-m68k <linux-m68k@...ts.linux-m68k.org>,
        "Jason A. Donenfeld" <Jason@...c4.com>
Subject: Re: [PATCH v9] kallsyms: Add self-test facility



On 2022/12/16 19:57, Andreas Schwab wrote:
> On Dez 16 2022, Leizhen (ThunderTown) wrote:
> 
>> It seems that the problem is still strcmp(). After I commented strcmp() in
>> arch/m68k/include/asm/string.h, and force it to use the one in lib/string.c,
>> it works well.
> 
> Does that help?

It still needs to add 'volatile' to prevent compiler optimizations.
Otherwise,
Tested-by: Zhen Lei <thunder.leizhen@...wei.com>

> 
> diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
> index f759d944c449..cdafd67774e0 100644
> --- a/arch/m68k/include/asm/string.h
> +++ b/arch/m68k/include/asm/string.h
> @@ -42,18 +42,19 @@ static inline char *strncpy(char *dest, const char *src, size_t n)
>  #define __HAVE_ARCH_STRCMP
>  static inline int strcmp(const char *cs, const char *ct)
>  {
> -	char res;
> +	int res = 0, tmp = 0;
>  
>  	asm ("\n"

-       asm ("\n"
+       asm volatile ("\n"


>  		"1:	move.b	(%0)+,%2\n"	/* get *cs */
> -		"	cmp.b	(%1)+,%2\n"	/* compare a byte */
> +		"	move.b	(%1)+,%3\n"	/* get *ct */
> +		"	cmp.b	%3,%2\n"	/* compare a byte */
>  		"	jne	2f\n"		/* not equal, break out */
>  		"	tst.b	%2\n"		/* at end of cs? */
>  		"	jne	1b\n"		/* no, keep going */
>  		"	jra	3f\n"		/* strings are equal */
> -		"2:	sub.b	-(%1),%2\n"	/* *cs - *ct */
> +		"2:	sub.l	%3,%2\n"	/* *cs - *ct */
>  		"3:"
> -		: "+a" (cs), "+a" (ct), "=d" (res));
> +		: "+a" (cs), "+a" (ct), "+d" (res), "+d" (tmp));
>  	return res;
>  }
>  #endif /* CONFIG_COLDFIRE */
> 

-- 
Regards,
  Zhen Lei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ