Re: [External] Re: [PATCH v2 1/2] selftests: proc: Fix proc-empty-vm build error on non x86_64

From: Punit Agrawal
Date: Thu Nov 10 2022 - 09:34:17 EST


Hi Andrew,

Thanks for taking a look.

Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:

> On Wed, 9 Nov 2022 22:11:03 +0000 Punit Agrawal <punit.agrawal@xxxxxxxxxxxxx> wrote:
>
>> The proc-empty-vm test is implemented for x86_64 and fails to build
>> for other architectures. Rather then emitting a compiler error it
>> would be preferable to only build the test on supported architectures.
>
> Why does it fail? What would be involved in making it available
> on other architectures?

The test is written to fail building on architectures other than
x86_64.

#ifdef __amd64__
munmap(NULL, ((size_t)1 << 47) - 4096);
#else
#error "implement 'unmap everything'"
#endif

I hit the build failure while semi-automating the running of tests on
internal infrastructure.

I am not familiar with the issue being tested but after a bit of
staring, it looks like there are two architecture dependent components
to the tests -

1. TASK_SIZE / application memory layout - the test unmaps the
entire the user virtual address space. For this, it needs to know
the length to pass to munmap().

Although it's possible to add this per-architecture, I am not
sure if there is a way to discover the length passed to munmap().

2. How the vsyscall page (if implemented) is mapped - this
influences the known good values used for comparison in the test.

It doesn't look like vsyscall page is used on arm64 but I am not
sure about the situation with other architectures.

(Alexey, please add if I've missed anything)

Thanks,
Punit