2024-06-03 13:29:13

by Muhammad Usama Anjum

[permalink] [raw]
Subject: [Bug Report] selftests: arm64: build errors

Hi,

I'm trying to build arm64 selftests on next-20240529. I'm getting build
failures. Complete logs are attached while some snippets are as following:

gcc pac.c /pauth/pac_corruptor.o /pauth/helper.o -o /pauth/pac -Wall -O2 -g
-I/linux_mainline/tools/testing/selftests/ -I/linux_mainline/tools/include
-mbranch-protection=pac-ret -march=armv8.2-a
In file included from pac.c:13:
../../kselftest_harness.h: In function ‘clone3_vfork’:
../../kselftest_harness.h:88:9: error: variable ‘args’ has initializer but
incomplete type
88 | struct clone_args args = {

CC check_prctl
check_prctl.c: In function ‘set_tagged_addr_ctrl’:
check_prctl.c:19:14: error: ‘PR_SET_TAGGED_ADDR_CTRL’ undeclared (first use
in this function)
19 | ret = prctl(PR_SET_TAGGED_ADDR_CTRL, val, 0, 0, 0);

gcc -mbranch-protection=standard -DBTI=1 -ffreestanding -Wall -Wextra -Wall
-O2 -g -I/linux_mainline/tools/testing/selftests/
-I/linux_mainline/tools/include -c -o /bti/test-bti.o test.c
test.c: In function ‘handler’:
test.c:85:50: error: ‘PSR_BTYPE_MASK’ undeclared (first use in this
function); did you mean ‘PSR_MODE_MASK’?
85 | write(1, &"00011011"[((uc->uc_mcontext.pstate & PSR_BTYPE_MASK)

I've GCC 8 installed. I'm not expecting the errors because of a little
older compiler. Any more ideas about the failures?

--
BR,
Muhammad Usama Anjum


Attachments:
build-log (28.32 kB)

2024-06-03 13:42:56

by Mark Brown

[permalink] [raw]
Subject: Re: [Bug Report] selftests: arm64: build errors

On Mon, Jun 03, 2024 at 06:28:16PM +0500, Muhammad Usama Anjum wrote:

> gcc pac.c /pauth/pac_corruptor.o /pauth/helper.o -o /pauth/pac -Wall -O2 -g
> -I/linux_mainline/tools/testing/selftests/ -I/linux_mainline/tools/include
> -mbranch-protection=pac-ret -march=armv8.2-a
> In file included from pac.c:13:
> ../../kselftest_harness.h: In function ‘clone3_vfork’:
> ../../kselftest_harness.h:88:9: error: variable ‘args’ has initializer but
> incomplete type
> 88 | struct clone_args args = {

This is in the generic code.

> CC check_prctl
> check_prctl.c: In function ‘set_tagged_addr_ctrl’:
> check_prctl.c:19:14: error: ‘PR_SET_TAGGED_ADDR_CTRL’ undeclared (first use
> in this function)
> 19 | ret = prctl(PR_SET_TAGGED_ADDR_CTRL, val, 0, 0, 0);
>
> gcc -mbranch-protection=standard -DBTI=1 -ffreestanding -Wall -Wextra -Wall
> -O2 -g -I/linux_mainline/tools/testing/selftests/
> -I/linux_mainline/tools/include -c -o /bti/test-bti.o test.c
> test.c: In function ‘handler’:
> test.c:85:50: error: ‘PSR_BTYPE_MASK’ undeclared (first use in this
> function); did you mean ‘PSR_MODE_MASK’?
> 85 | write(1, &"00011011"[((uc->uc_mcontext.pstate & PSR_BTYPE_MASK)

> I've GCC 8 installed. I'm not expecting the errors because of a little
> older compiler. Any more ideas about the failures?

You need to run headers_install IIRC.


Attachments:
(No filename) (1.38 kB)
signature.asc (499.00 B)
Download all attachments

2024-06-04 08:14:38

by Muhammad Usama Anjum

[permalink] [raw]
Subject: Re: [Bug Report] selftests: arm64: build errors

On 6/3/24 6:31 PM, Mark Brown wrote:
> On Mon, Jun 03, 2024 at 06:28:16PM +0500, Muhammad Usama Anjum wrote:
>
>> gcc pac.c /pauth/pac_corruptor.o /pauth/helper.o -o /pauth/pac -Wall -O2 -g
>> -I/linux_mainline/tools/testing/selftests/ -I/linux_mainline/tools/include
>> -mbranch-protection=pac-ret -march=armv8.2-a
>> In file included from pac.c:13:
>> ../../kselftest_harness.h: In function ‘clone3_vfork’:
>> ../../kselftest_harness.h:88:9: error: variable ‘args’ has initializer but
>> incomplete type
>> 88 | struct clone_args args = {
>
> This is in the generic code.
>
>> CC check_prctl
>> check_prctl.c: In function ‘set_tagged_addr_ctrl’:
>> check_prctl.c:19:14: error: ‘PR_SET_TAGGED_ADDR_CTRL’ undeclared (first use
>> in this function)
>> 19 | ret = prctl(PR_SET_TAGGED_ADDR_CTRL, val, 0, 0, 0);
>>
>> gcc -mbranch-protection=standard -DBTI=1 -ffreestanding -Wall -Wextra -Wall
>> -O2 -g -I/linux_mainline/tools/testing/selftests/
>> -I/linux_mainline/tools/include -c -o /bti/test-bti.o test.c
>> test.c: In function ‘handler’:
>> test.c:85:50: error: ‘PSR_BTYPE_MASK’ undeclared (first use in this
>> function); did you mean ‘PSR_MODE_MASK’?
>> 85 | write(1, &"00011011"[((uc->uc_mcontext.pstate & PSR_BTYPE_MASK)
>
>> I've GCC 8 installed. I'm not expecting the errors because of a little
>> older compiler. Any more ideas about the failures?
>
> You need to run headers_install IIRC.
I'm running:
make headers && make -C tools/testing/selftests

I've tried gcc 12 as well.


--
BR,
Muhammad Usama Anjum

2024-06-05 20:56:02

by Mark Brown

[permalink] [raw]
Subject: Re: [Bug Report] selftests: arm64: build errors

On Tue, Jun 04, 2024 at 01:13:45PM +0500, Muhammad Usama Anjum wrote:
> On 6/3/24 6:31 PM, Mark Brown wrote:
> > On Mon, Jun 03, 2024 at 06:28:16PM +0500, Muhammad Usama Anjum wrote:

> >> test.c: In function ‘handler’:
> >> test.c:85:50: error: ‘PSR_BTYPE_MASK’ undeclared (first use in this
> >> function); did you mean ‘PSR_MODE_MASK’?
> >> 85 | write(1, &"00011011"[((uc->uc_mcontext.pstate & PSR_BTYPE_MASK)

> >> I've GCC 8 installed. I'm not expecting the errors because of a little
> >> older compiler. Any more ideas about the failures?

> > You need to run headers_install IIRC.

> I'm running:
> make headers && make -C tools/testing/selftests

> I've tried gcc 12 as well.

It's your system headers (or not finding the kernel ones anyway) rather
that the compiler. For PSR_BTYPE_MASK it's ptrace.h that's needed.


Attachments:
(No filename) (863.00 B)
signature.asc (499.00 B)
Download all attachments