linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prabhakar Kushwaha <prabhakar.pkin@gmail.com>
To: linux-kselftest@vger.kernel.org
Subject: Re: Linux-5.4: bpf: test_core_reloc_arrays.o: Segmentation fault with llc -march=bpf
Date: Mon, 21 Oct 2019 09:20:51 +0530	[thread overview]
Message-ID: <CAJ2QiJK9R7EQsWOw1ugegURPZ0bBx7N1fSu_VzUjK5gxRW8A0g@mail.gmail.com> (raw)
In-Reply-To: <aed8eda7-df20-069b-ea14-f06628984566@gmail.com>

On Sun, Oct 20, 2019 at 7:18 PM Prabhakar Kushwaha
<prabhakar.pkin@gmail.com> wrote:
>
>
> Hi All,
>
> I am trying to build kselftest on Linux-5.4 on ubuntu 18.04. I installed
> LLVM-9.0.0 and Clang-9.0.0 from below links after following steps from
> [1] because of discussion [2]
>
>  https://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz
>  https://releases.llvm.org/9.0.0/clang-tools-extra-9.0.0.src.tar.xz
>  https://releases.llvm.org/9.0.0/cfe-9.0.0.src.tar.xz
>
>
> Now, i am trying with llc -march=bpf, with this segmentation fault is
> coming as below:
>
>
> gcc -g -Wall -O2 -I../../../include/uapi -I../../../lib
> -I../../../lib/bpf -I../../../../include/generated -DHAVE_GENHDR
> -I../../../include -Dbpf_prog_load=bpf_prog_test_load
> -Dbpf_load_program=bpf_test_load_program    test_flow_dissector.c
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_stub.o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf
> -lrt -lpthread -o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_flow_dissector
> gcc -g -Wall -O2 -I../../../include/uapi -I../../../lib
> -I../../../lib/bpf -I../../../../include/generated -DHAVE_GENHDR
> -I../../../include -Dbpf_prog_load=bpf_prog_test_load
> -Dbpf_load_program=bpf_test_load_program
> test_tcp_check_syncookie_user.c
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_stub.o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf
> -lrt -lpthread -o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_tcp_check_syncookie_user
> gcc -g -Wall -O2 -I../../../include/uapi -I../../../lib
> -I../../../lib/bpf -I../../../../include/generated -DHAVE_GENHDR
> -I../../../include -Dbpf_prog_load=bpf_prog_test_load
> -Dbpf_load_program=bpf_test_load_program    test_lirc_mode2_user.c
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_stub.o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf
> -lrt -lpthread -o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_lirc_mode2_user
> (clang -I. -I./include/uapi -I../../../include/uapi
> -I/usr/src/tovards/linux/tools/testing/selftests/bpf/../usr/include
> -D__TARGET_ARCH_arm64 -g -idirafter /usr/local/include -idirafter
> /usr/local/lib/clang/9.0.0/include -idirafter
> /usr/include/aarch64-linux-gnu -idirafter /usr/include
> -Wno-compare-distinct-pointer-types -O2 -target bpf -emit-llvm \
>         -c progs/test_core_reloc_arrays.c -o - || echo "clang failed") | \
> llc -march=bpf -mcpu=probe  -filetype=obj -o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_arrays.o
> Stack dump:
> 0.      Program arguments: llc -march=bpf -mcpu=probe -filetype=obj -o
> /usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_arrays.o
> 1.      Running pass 'Function Pass Manager' on module '<stdin>'.
> 2.      Running pass 'BPF Assembly Printer' on function '@test_core_arrays'
> #0 0x0000aaaac618db08 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
> (/usr/local/bin/llc+0x152eb08)
> Segmentation fault
> Makefile:260: recipe for target
> '/usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_arrays.o'
> failed
> make[1]: ***
> [/usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_arrays.o]
> Error 139
>

To add more details,
Commenting following lines in bpf/progs/test_core_reloc_arrays.c
removes the segmentation fault.

--- a/tools/testing/selftests/bpf/progs/test_core_reloc_arrays.c
+++ b/tools/testing/selftests/bpf/progs/test_core_reloc_arrays.c
@@ -41,15 +41,14 @@ int test_core_arrays(void *ctx)
        if (BPF_CORE_READ(&out->a2, &in->a[2]))
                return 1;
        /* in->b[1][2][3] */
-       if (BPF_CORE_READ(&out->b123, &in->b[1][2][3]))
-               return 1;
+//     if (BPF_CORE_READ(&out->b123, &in->b[1][2][3]))
+//             return 1;
        /* in->c[1].c */
        if (BPF_CORE_READ(&out->c1c, &in->c[1].c))
                return 1;
        /* in->d[0][0].d */
-       if (BPF_CORE_READ(&out->d00d, &in->d[0][0].d))
-               return 1;
-
+//     if (BPF_CORE_READ(&out->d00d, &in->d[0][0].d))
+//             return 1;
        return 0;
 }

It looks to be something related llc and more than 1 dimension array.
has anyone faced such error.

--prabhakar (pk)

  reply	other threads:[~2019-10-21  3:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-20 13:47 Prabhakar Kushwaha
2019-10-21  3:50 ` Prabhakar Kushwaha [this message]
2019-10-22 14:12 Prabhakar Kushwaha
2019-10-23  1:35 Prabhakar Kushwaha
2019-10-23  2:34 ` Yonghong Song
2019-10-23  3:29   ` Prabhakar Kushwaha
2019-10-23  4:42     ` Yonghong Song
2019-10-23  8:49       ` Prabhakar Kushwaha
2019-10-24 16:04 ` Ilya Leoshkevich
2019-10-24 17:49   ` Yonghong Song
2019-10-24 18:31     ` Ilya Leoshkevich
2019-10-25 21:50       ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ2QiJK9R7EQsWOw1ugegURPZ0bBx7N1fSu_VzUjK5gxRW8A0g@mail.gmail.com \
    --to=prabhakar.pkin@gmail.com \
    --cc=linux-kselftest@vger.kernel.org \
    --subject='Re: Linux-5.4: bpf: test_core_reloc_arrays.o: Segmentation fault with llc -march=bpf' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).