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: <CAKwvOd=9tsHHhPBOx2ORZoJP09VsX5dRZn58qj3MzCc2vmVosg@mail.gmail.com>
Date:   Thu, 18 Nov 2021 17:10:48 -0800
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Ilie Halip <ilie.halip@...il.com>
Cc:     linux-kernel@...r.kernel.org, Heiko Carstens <hca@...ux.ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Nathan Chancellor <nathan@...nel.org>,
        Mete Durlu <meted@...ux.ibm.com>,
        Sven Schnelle <svens@...ux.ibm.com>,
        linux-s390@...r.kernel.org, llvm@...ts.linux.dev,
        Ulrich Weigand <Ulrich.Weigand@...ibm.com>
Subject: Re: [PATCH] s390/test_unwind: use raw opcode instead of invalid instruction

On Wed, Nov 17, 2021 at 9:48 AM Ilie Halip <ilie.halip@...il.com> wrote:
>
> Building with clang & LLVM_IAS=1 leads to an error:
>     arch/s390/lib/test_unwind.c:179:4: error: invalid register pair
>                         "       mvcl    %%r1,%%r1\n"
>                         ^
>
> The test creates an invalid instruction that would trap at runtime, but the
> LLVM inline assembler tries to validate it at compile time too.
>
> Use the raw instruction opcode instead.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1421
> Reported-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Signed-off-by: Ilie Halip <ilie.halip@...il.com>

Ilie, thanks for the patch!

So if I understand
https://sourceware.org/binutils/docs/as/s390-Directives.html#s390-Directives
https://sourceware.org/binutils/docs/as/s390-Formats.html
that `e,` prefix is for 16B opcodes?

LGTM, thanks again.
Suggested-by: Ulrich Weigand <Ulrich.Weigand@...ibm.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

I triple checked that GAS, clang, and GNU objdump are in agreement in
terms of encoding here.

> ---
>  arch/s390/lib/test_unwind.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/lib/test_unwind.c b/arch/s390/lib/test_unwind.c
> index cfc5f5557c06..d342bc884b94 100644
> --- a/arch/s390/lib/test_unwind.c
> +++ b/arch/s390/lib/test_unwind.c
> @@ -176,7 +176,7 @@ static noinline int unwindme_func4(struct unwindme *u)
>                  * trigger specification exception
>                  */
>                 asm volatile(
> -                       "       mvcl    %%r1,%%r1\n"
> +                       "       .insn e,0x0e11\n"       /* mvcl %%r1,%%r1" */
>                         "0:     nopr    %%r7\n"
>                         EX_TABLE(0b, 0b)
>                         :);
> --
> 2.25.1
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ