diff mbox series

[bpf-next] bpf: Fix a few selftest failures due to llvm18 change

Message ID 20231127050342.1945270-1-yonghong.song@linux.dev (mailing list archive)
State Accepted
Commit b16904fd9f01b580db357ef2b1cc9e86d89576c2
Delegated to: BPF
Headers show
Series [bpf-next] bpf: Fix a few selftest failures due to llvm18 change | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-0 success Logs for Lint
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-3 success Logs for aarch64-gcc / build / build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for aarch64-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-4 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-15 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-6 success Logs for aarch64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-19 success Logs for x86_64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for s390x-gcc / build / build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for x86_64-llvm-16 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-25 success Logs for x86_64-llvm-16 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-24 success Logs for x86_64-llvm-16 / build / build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-22 success Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for x86_64-llvm-16 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-18 success Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for x86_64-llvm-16 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-14 success Logs for s390x-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-29 success Logs for x86_64-llvm-16 / veristat
bpf/vmtest-bpf-next-VM_Test-17 success Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-5 success Logs for aarch64-gcc / test (test_progs, false, 360) / test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-12 success Logs for s390x-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-11 success Logs for s390x-gcc / test (test_progs, false, 360) / test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for s390x-gcc / test (test_maps, false, 360) / test_maps on s390x with gcc
netdev/series_format success Single patches do not need cover letters
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1132 this patch: 1132
netdev/cc_maintainers warning 18 maintainers not CCed: netdev@vger.kernel.org edumazet@google.com pabeni@redhat.com jolsa@kernel.org kuba@kernel.org song@kernel.org llvm@lists.linux.dev martin.lau@linux.dev ndesaulniers@google.com kpsingh@kernel.org john.fastabend@gmail.com sdf@google.com haoluo@google.com mykolal@fb.com linux-kselftest@vger.kernel.org trix@redhat.com shuah@kernel.org nathan@kernel.org
netdev/build_clang success Errors and warnings before: 1143 this patch: 1143
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1159 this patch: 1159
netdev/checkpatch fail ERROR: spaces required around that ':' (ctx:VxW)
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yonghong Song Nov. 27, 2023, 5:03 a.m. UTC
With latest upstream llvm18, the following test cases failed:
  $ ./test_progs -j
  #13/2    bpf_cookie/multi_kprobe_link_api:FAIL
  #13/3    bpf_cookie/multi_kprobe_attach_api:FAIL
  #13      bpf_cookie:FAIL
  #77      fentry_fexit:FAIL
  #78/1    fentry_test/fentry:FAIL
  #78      fentry_test:FAIL
  #82/1    fexit_test/fexit:FAIL
  #82      fexit_test:FAIL
  #112/1   kprobe_multi_test/skel_api:FAIL
  #112/2   kprobe_multi_test/link_api_addrs:FAIL
  ...
  #112     kprobe_multi_test:FAIL
  #356/17  test_global_funcs/global_func17:FAIL
  #356     test_global_funcs:FAIL

Further analysis shows llvm upstream patch [1] is responsible
for the above failures. For example, for function bpf_fentry_test7()
in net/bpf/test_run.c, without [1], the asm code is:
  0000000000000400 <bpf_fentry_test7>:
     400: f3 0f 1e fa                   endbr64
     404: e8 00 00 00 00                callq   0x409 <bpf_fentry_test7+0x9>
     409: 48 89 f8                      movq    %rdi, %rax
     40c: c3                            retq
     40d: 0f 1f 00                      nopl    (%rax)
and with [1], the asm code is:
  0000000000005d20 <bpf_fentry_test7.specialized.1>:
    5d20: e8 00 00 00 00                callq   0x5d25 <bpf_fentry_test7.specialized.1+0x5>
    5d25: c3                            retq
and <bpf_fentry_test7.specialized.1> is called instead of <bpf_fentry_test7>
and this caused test failures for #13/#77 etc. except #356.

For test case #356/17, with [1] (progs/test_global_func17.c)),
the main prog looks like:
  0000000000000000 <global_func17>:
       0:       b4 00 00 00 2a 00 00 00 w0 = 0x2a
       1:       95 00 00 00 00 00 00 00 exit
which passed verification while the test itself expects a verification
failure.

Let us add 'barrier_var' style asm code in both places to prevent
function specialization which caused selftests failure.

  [1] https://github.com/llvm/llvm-project/pull/72903

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 net/bpf/test_run.c                                     | 2 +-
 tools/testing/selftests/bpf/progs/test_global_func17.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 27, 2023, 2 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Sun, 26 Nov 2023 21:03:42 -0800 you wrote:
> With latest upstream llvm18, the following test cases failed:
>   $ ./test_progs -j
>   #13/2    bpf_cookie/multi_kprobe_link_api:FAIL
>   #13/3    bpf_cookie/multi_kprobe_attach_api:FAIL
>   #13      bpf_cookie:FAIL
>   #77      fentry_fexit:FAIL
>   #78/1    fentry_test/fentry:FAIL
>   #78      fentry_test:FAIL
>   #82/1    fexit_test/fexit:FAIL
>   #82      fexit_test:FAIL
>   #112/1   kprobe_multi_test/skel_api:FAIL
>   #112/2   kprobe_multi_test/link_api_addrs:FAIL
>   ...
>   #112     kprobe_multi_test:FAIL
>   #356/17  test_global_funcs/global_func17:FAIL
>   #356     test_global_funcs:FAIL
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf: Fix a few selftest failures due to llvm18 change
    https://git.kernel.org/bpf/bpf-next/c/b16904fd9f01

You are awesome, thank you!
Andrii Nakryiko Nov. 27, 2023, 6:49 p.m. UTC | #2
On Sun, Nov 26, 2023 at 9:04 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>
> With latest upstream llvm18, the following test cases failed:
>   $ ./test_progs -j
>   #13/2    bpf_cookie/multi_kprobe_link_api:FAIL
>   #13/3    bpf_cookie/multi_kprobe_attach_api:FAIL
>   #13      bpf_cookie:FAIL
>   #77      fentry_fexit:FAIL
>   #78/1    fentry_test/fentry:FAIL
>   #78      fentry_test:FAIL
>   #82/1    fexit_test/fexit:FAIL
>   #82      fexit_test:FAIL
>   #112/1   kprobe_multi_test/skel_api:FAIL
>   #112/2   kprobe_multi_test/link_api_addrs:FAIL
>   ...
>   #112     kprobe_multi_test:FAIL
>   #356/17  test_global_funcs/global_func17:FAIL
>   #356     test_global_funcs:FAIL
>
> Further analysis shows llvm upstream patch [1] is responsible
> for the above failures. For example, for function bpf_fentry_test7()
> in net/bpf/test_run.c, without [1], the asm code is:
>   0000000000000400 <bpf_fentry_test7>:
>      400: f3 0f 1e fa                   endbr64
>      404: e8 00 00 00 00                callq   0x409 <bpf_fentry_test7+0x9>
>      409: 48 89 f8                      movq    %rdi, %rax
>      40c: c3                            retq
>      40d: 0f 1f 00                      nopl    (%rax)
> and with [1], the asm code is:
>   0000000000005d20 <bpf_fentry_test7.specialized.1>:
>     5d20: e8 00 00 00 00                callq   0x5d25 <bpf_fentry_test7.specialized.1+0x5>
>     5d25: c3                            retq
> and <bpf_fentry_test7.specialized.1> is called instead of <bpf_fentry_test7>
> and this caused test failures for #13/#77 etc. except #356.
>
> For test case #356/17, with [1] (progs/test_global_func17.c)),
> the main prog looks like:
>   0000000000000000 <global_func17>:
>        0:       b4 00 00 00 2a 00 00 00 w0 = 0x2a
>        1:       95 00 00 00 00 00 00 00 exit
> which passed verification while the test itself expects a verification
> failure.
>
> Let us add 'barrier_var' style asm code in both places to prevent
> function specialization which caused selftests failure.
>
>   [1] https://github.com/llvm/llvm-project/pull/72903
>
> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> ---
>  net/bpf/test_run.c                                     | 2 +-
>  tools/testing/selftests/bpf/progs/test_global_func17.c | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index c9fdcc5cdce1..711cf5d59816 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -542,7 +542,7 @@ struct bpf_fentry_test_t {
>
>  int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
>  {
> -       asm volatile ("");
> +       asm volatile ("": "+r"(arg));
>         return (long)arg;
>  }
>
> diff --git a/tools/testing/selftests/bpf/progs/test_global_func17.c b/tools/testing/selftests/bpf/progs/test_global_func17.c
> index a32e11c7d933..5de44b09e8ec 100644
> --- a/tools/testing/selftests/bpf/progs/test_global_func17.c
> +++ b/tools/testing/selftests/bpf/progs/test_global_func17.c
> @@ -5,6 +5,7 @@
>
>  __noinline int foo(int *p)
>  {
> +       barrier_var(p);
>         return p ? (*p = 42) : 0;
>  }
>

I recently stumbled upon no_clone ([0]) and no_ipa ([1]) attributes.
Should we consider using those here instead?

  [0] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noclone-function-attribute
  [1] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noipa-function-attribute


> --
> 2.34.1
>
Yonghong Song Nov. 27, 2023, 7:49 p.m. UTC | #3
On 11/27/23 1:49 PM, Andrii Nakryiko wrote:
> On Sun, Nov 26, 2023 at 9:04 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>> With latest upstream llvm18, the following test cases failed:
>>    $ ./test_progs -j
>>    #13/2    bpf_cookie/multi_kprobe_link_api:FAIL
>>    #13/3    bpf_cookie/multi_kprobe_attach_api:FAIL
>>    #13      bpf_cookie:FAIL
>>    #77      fentry_fexit:FAIL
>>    #78/1    fentry_test/fentry:FAIL
>>    #78      fentry_test:FAIL
>>    #82/1    fexit_test/fexit:FAIL
>>    #82      fexit_test:FAIL
>>    #112/1   kprobe_multi_test/skel_api:FAIL
>>    #112/2   kprobe_multi_test/link_api_addrs:FAIL
>>    ...
>>    #112     kprobe_multi_test:FAIL
>>    #356/17  test_global_funcs/global_func17:FAIL
>>    #356     test_global_funcs:FAIL
>>
>> Further analysis shows llvm upstream patch [1] is responsible
>> for the above failures. For example, for function bpf_fentry_test7()
>> in net/bpf/test_run.c, without [1], the asm code is:
>>    0000000000000400 <bpf_fentry_test7>:
>>       400: f3 0f 1e fa                   endbr64
>>       404: e8 00 00 00 00                callq   0x409 <bpf_fentry_test7+0x9>
>>       409: 48 89 f8                      movq    %rdi, %rax
>>       40c: c3                            retq
>>       40d: 0f 1f 00                      nopl    (%rax)
>> and with [1], the asm code is:
>>    0000000000005d20 <bpf_fentry_test7.specialized.1>:
>>      5d20: e8 00 00 00 00                callq   0x5d25 <bpf_fentry_test7.specialized.1+0x5>
>>      5d25: c3                            retq
>> and <bpf_fentry_test7.specialized.1> is called instead of <bpf_fentry_test7>
>> and this caused test failures for #13/#77 etc. except #356.
>>
>> For test case #356/17, with [1] (progs/test_global_func17.c)),
>> the main prog looks like:
>>    0000000000000000 <global_func17>:
>>         0:       b4 00 00 00 2a 00 00 00 w0 = 0x2a
>>         1:       95 00 00 00 00 00 00 00 exit
>> which passed verification while the test itself expects a verification
>> failure.
>>
>> Let us add 'barrier_var' style asm code in both places to prevent
>> function specialization which caused selftests failure.
>>
>>    [1] https://github.com/llvm/llvm-project/pull/72903
>>
>> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
>> ---
>>   net/bpf/test_run.c                                     | 2 +-
>>   tools/testing/selftests/bpf/progs/test_global_func17.c | 1 +
>>   2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
>> index c9fdcc5cdce1..711cf5d59816 100644
>> --- a/net/bpf/test_run.c
>> +++ b/net/bpf/test_run.c
>> @@ -542,7 +542,7 @@ struct bpf_fentry_test_t {
>>
>>   int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
>>   {
>> -       asm volatile ("");
>> +       asm volatile ("": "+r"(arg));
>>          return (long)arg;
>>   }
>>
>> diff --git a/tools/testing/selftests/bpf/progs/test_global_func17.c b/tools/testing/selftests/bpf/progs/test_global_func17.c
>> index a32e11c7d933..5de44b09e8ec 100644
>> --- a/tools/testing/selftests/bpf/progs/test_global_func17.c
>> +++ b/tools/testing/selftests/bpf/progs/test_global_func17.c
>> @@ -5,6 +5,7 @@
>>
>>   __noinline int foo(int *p)
>>   {
>> +       barrier_var(p);
>>          return p ? (*p = 42) : 0;
>>   }
>>
> I recently stumbled upon no_clone ([0]) and no_ipa ([1]) attributes.
> Should we consider using those here instead?
>
>    [0] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noclone-function-attribute
>    [1] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noipa-function-attribute

noipa attribute might help here. But sadly, noclone and noipa are gcc specific
and clang does not support either of them.

>
>
>> --
>> 2.34.1
>>
Andrii Nakryiko Nov. 27, 2023, 7:57 p.m. UTC | #4
On Mon, Nov 27, 2023 at 11:49 AM Yonghong Song <yonghong.song@linux.dev> wrote:
>
>
> On 11/27/23 1:49 PM, Andrii Nakryiko wrote:
> > On Sun, Nov 26, 2023 at 9:04 PM Yonghong Song <yonghong.song@linux.dev> wrote:
> >> With latest upstream llvm18, the following test cases failed:
> >>    $ ./test_progs -j
> >>    #13/2    bpf_cookie/multi_kprobe_link_api:FAIL
> >>    #13/3    bpf_cookie/multi_kprobe_attach_api:FAIL
> >>    #13      bpf_cookie:FAIL
> >>    #77      fentry_fexit:FAIL
> >>    #78/1    fentry_test/fentry:FAIL
> >>    #78      fentry_test:FAIL
> >>    #82/1    fexit_test/fexit:FAIL
> >>    #82      fexit_test:FAIL
> >>    #112/1   kprobe_multi_test/skel_api:FAIL
> >>    #112/2   kprobe_multi_test/link_api_addrs:FAIL
> >>    ...
> >>    #112     kprobe_multi_test:FAIL
> >>    #356/17  test_global_funcs/global_func17:FAIL
> >>    #356     test_global_funcs:FAIL
> >>
> >> Further analysis shows llvm upstream patch [1] is responsible
> >> for the above failures. For example, for function bpf_fentry_test7()
> >> in net/bpf/test_run.c, without [1], the asm code is:
> >>    0000000000000400 <bpf_fentry_test7>:
> >>       400: f3 0f 1e fa                   endbr64
> >>       404: e8 00 00 00 00                callq   0x409 <bpf_fentry_test7+0x9>
> >>       409: 48 89 f8                      movq    %rdi, %rax
> >>       40c: c3                            retq
> >>       40d: 0f 1f 00                      nopl    (%rax)
> >> and with [1], the asm code is:
> >>    0000000000005d20 <bpf_fentry_test7.specialized.1>:
> >>      5d20: e8 00 00 00 00                callq   0x5d25 <bpf_fentry_test7.specialized.1+0x5>
> >>      5d25: c3                            retq
> >> and <bpf_fentry_test7.specialized.1> is called instead of <bpf_fentry_test7>
> >> and this caused test failures for #13/#77 etc. except #356.
> >>
> >> For test case #356/17, with [1] (progs/test_global_func17.c)),
> >> the main prog looks like:
> >>    0000000000000000 <global_func17>:
> >>         0:       b4 00 00 00 2a 00 00 00 w0 = 0x2a
> >>         1:       95 00 00 00 00 00 00 00 exit
> >> which passed verification while the test itself expects a verification
> >> failure.
> >>
> >> Let us add 'barrier_var' style asm code in both places to prevent
> >> function specialization which caused selftests failure.
> >>
> >>    [1] https://github.com/llvm/llvm-project/pull/72903
> >>
> >> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> >> ---
> >>   net/bpf/test_run.c                                     | 2 +-
> >>   tools/testing/selftests/bpf/progs/test_global_func17.c | 1 +
> >>   2 files changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> >> index c9fdcc5cdce1..711cf5d59816 100644
> >> --- a/net/bpf/test_run.c
> >> +++ b/net/bpf/test_run.c
> >> @@ -542,7 +542,7 @@ struct bpf_fentry_test_t {
> >>
> >>   int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
> >>   {
> >> -       asm volatile ("");
> >> +       asm volatile ("": "+r"(arg));
> >>          return (long)arg;
> >>   }
> >>
> >> diff --git a/tools/testing/selftests/bpf/progs/test_global_func17.c b/tools/testing/selftests/bpf/progs/test_global_func17.c
> >> index a32e11c7d933..5de44b09e8ec 100644
> >> --- a/tools/testing/selftests/bpf/progs/test_global_func17.c
> >> +++ b/tools/testing/selftests/bpf/progs/test_global_func17.c
> >> @@ -5,6 +5,7 @@
> >>
> >>   __noinline int foo(int *p)
> >>   {
> >> +       barrier_var(p);
> >>          return p ? (*p = 42) : 0;
> >>   }
> >>
> > I recently stumbled upon no_clone ([0]) and no_ipa ([1]) attributes.
> > Should we consider using those here instead?
> >
> >    [0] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noclone-function-attribute
> >    [1] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noipa-function-attribute
>
> noipa attribute might help here. But sadly, noclone and noipa are gcc specific
> and clang does not support either of them.

I see, that's too bad, I assumed Clang also supports something like
that. Maybe someday.

>
> >
> >
> >> --
> >> 2.34.1
> >>
diff mbox series

Patch

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index c9fdcc5cdce1..711cf5d59816 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -542,7 +542,7 @@  struct bpf_fentry_test_t {
 
 int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
 {
-	asm volatile ("");
+	asm volatile ("": "+r"(arg));
 	return (long)arg;
 }
 
diff --git a/tools/testing/selftests/bpf/progs/test_global_func17.c b/tools/testing/selftests/bpf/progs/test_global_func17.c
index a32e11c7d933..5de44b09e8ec 100644
--- a/tools/testing/selftests/bpf/progs/test_global_func17.c
+++ b/tools/testing/selftests/bpf/progs/test_global_func17.c
@@ -5,6 +5,7 @@ 
 
 __noinline int foo(int *p)
 {
+	barrier_var(p);
 	return p ? (*p = 42) : 0;
 }