History log of /linux-6.15/tools/testing/selftests/proc/proc-empty-vm.c (Results 1 – 10 of 10)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3
# 2d87af06 03-Jun-2024 Amer Al Shanawany <[email protected]>

selftests: proc: remove unreached code and fix build warning

fix the following warning:
proc-empty-vm.c:385:17: warning: ignoring return value of `write'
declared with attribute `warn_unused_result

selftests: proc: remove unreached code and fix build warning

fix the following warning:
proc-empty-vm.c:385:17: warning: ignoring return value of `write'
declared with attribute `warn_unused_result' [-Wunused-result]
385 | write(1, buf, rv);
| ^~~~~~~~~~~~~~~~~

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Amer Al Shanawany <[email protected]>
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]/
Cc: Alexey Dobriyan <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Javier Carrasco <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Swarup Laxman Kotiaklapudi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


Revision tags: v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1, v6.6
# bf5add39 27-Oct-2023 Swarup Laxman Kotiaklapudi <[email protected]>

proc: test ProtectionKey in proc-empty-vm test

Check ProtectionKey field in /proc/*/smaps output, if system supports
protection keys feature.

[[email protected]: test support in the beginning of

proc: test ProtectionKey in proc-empty-vm test

Check ProtectionKey field in /proc/*/smaps output, if system supports
protection keys feature.

[[email protected]: test support in the beginning of the program, use syscall, not glibc pkey_alloc(3) which may not compile]

Link: https://lkml.kernel.org/r/ac05efa7-d2a0-48ad-b704-ffdd5450582e@p183
Signed-off-by: Swarup Laxman Kotiaklapudi <[email protected]>
Signed-off-by: Alexey Dobriyan <[email protected]>
Reviewed-by: Swarup Laxman Kotikalapudi<[email protected]>
Tested-by: Swarup Laxman Kotikalapudi<[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


# 20e34aa7 27-Oct-2023 Alexey Dobriyan <[email protected]>

proc: fix proc-empty-vm test with vsyscall

* fix embarassing /proc/*/smaps test bug due to a typo in variable name
it tested only the first line of the output if vsyscall is enabled:

fffffffff

proc: fix proc-empty-vm test with vsyscall

* fix embarassing /proc/*/smaps test bug due to a typo in variable name
it tested only the first line of the output if vsyscall is enabled:

ffffffffff600000-ffffffffff601000 r-xp ...

so test passed but tested only VMA location and permissions.

* add "KSM" entry, unnoticed because (1)

* swap "r-xp" and "--xp" vsyscall test strings,
also unnoticed because (1)

Link: https://lkml.kernel.org/r/76f42cce-b1ab-45ec-b6b2-4c64f0dccb90@p183
Signed-off-by: Alexey Dobriyan <[email protected]>
Tested-by: Swarup Laxman Kotikalapudi<[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


Revision tags: v6.6-rc7, v6.6-rc6
# 6e79b375 09-Oct-2023 Swarup Laxman Kotiaklapudi <[email protected]>

proc: test /proc/${pid}/statm

My original comment lied, output can be "0 A A B 0 0 0\n"
(see comment in the code).

I don't quite understand why

get_mm_counter(mm, MM_FILEPAGES) + get_mm_counter(m

proc: test /proc/${pid}/statm

My original comment lied, output can be "0 A A B 0 0 0\n"
(see comment in the code).

I don't quite understand why

get_mm_counter(mm, MM_FILEPAGES) + get_mm_counter(mm, MM_SHMEMPAGES)

can stay positive but get_mm_counter(mm, MM_ANONPAGES) is always 0 after
everything is unmapped but that's just me.

[[email protected]: more or less rewritten]
Link: https://lkml.kernel.org/r/0721ca69-7bb4-40aa-8d01-0c5f91e5f363@p183
Signed-off-by: Swarup Laxman Kotiaklapudi <[email protected]>
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


Revision tags: v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1
# 9d1be94d 07-Sep-2023 Alexey Dobriyan <[email protected]>

selftests/proc: fixup proc-empty-vm test after KSM changes

/proc/${pid}/smaps_rollup is not empty file even if process's address
space is empty, update the test.

Link: https://lkml.kernel.org/r/725

selftests/proc: fixup proc-empty-vm test after KSM changes

/proc/${pid}/smaps_rollup is not empty file even if process's address
space is empty, update the test.

Link: https://lkml.kernel.org/r/725e041f-e9df-4f3d-b267-d4cd2774a78d@p183
Signed-off-by: Alexey Dobriyan <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Stefan Roesch <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


Revision tags: v6.5, v6.5-rc7
# daa60ae6 14-Aug-2023 Hugh Dickins <[email protected]>

mm,thp: fix smaps THPeligible output alignment

Extract from current /proc/self/smaps output:

Swap: 0 kB
SwapPss: 0 kB
Locked: 0 kB
THPeligible: 0
Pr

mm,thp: fix smaps THPeligible output alignment

Extract from current /proc/self/smaps output:

Swap: 0 kB
SwapPss: 0 kB
Locked: 0 kB
THPeligible: 0
ProtectionKey: 0

That's not the alignment shown in Documentation/filesystems/proc.rst: it's
an ugly artifact from missing out the %8 other fields are using; but
there's even one selftest which expects it to look that way. Hoping no
other smaps parsers depend on THPeligible to look so ugly, fix these.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Hugh Dickins <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


Revision tags: v6.5-rc6, v6.5-rc5, v6.5-rc4, v6.5-rc3, v6.5-rc2, v6.5-rc1
# f58a2dd8 30-Jun-2023 Alexey Dobriyan <[email protected]>

proc: skip proc-empty-vm on anything but amd64 and i386

This test is arch specific, requires "munmap everything" primitive.

Link: https://lkml.kernel.org/r/[email protected]

proc: skip proc-empty-vm on anything but amd64 and i386

This test is arch specific, requires "munmap everything" primitive.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Alexey Dobriyan <[email protected]>
Cc: Björn Töpel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


# 4356b11e 30-Jun-2023 Alexey Dobriyan <[email protected]>

proc: support proc-empty-vm test on i386

Unmap everything starting from 4GB length until it unmaps, otherwise test
has to detect which virtual memory split kernel is using.

Link: https://lkml.kerne

proc: support proc-empty-vm test on i386

Unmap everything starting from 4GB length until it unmaps, otherwise test
has to detect which virtual memory split kernel is using.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Alexey Dobriyan <[email protected]>
Cc: Björn Töpel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


Revision tags: v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6, v6.3-rc5, v6.3-rc4, v6.3-rc3, v6.3-rc2, v6.3-rc1, v6.2, v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4, v6.2-rc3
# 5316a017 06-Jan-2023 Alexey Dobriyan <[email protected]>

proc: fix PIE proc-empty-vm, proc-pid-vm tests

vsyscall detection code uses direct call to the beginning of
the vsyscall page:

asm ("call %P0" :: "i" (0xffffffffff600000))

It generates "call rel3

proc: fix PIE proc-empty-vm, proc-pid-vm tests

vsyscall detection code uses direct call to the beginning of
the vsyscall page:

asm ("call %P0" :: "i" (0xffffffffff600000))

It generates "call rel32" instruction but it is not relocated if binary
is PIE, so binary segfaults into random userspace address and vsyscall
page status is detected incorrectly.

Do more direct:

asm ("call *%rax")

which doesn't do need any relocaltions.

Mark g_vsyscall as volatile for a good measure, I didn't find instruction
setting it to 0. Now the code is obviously correct:

xor eax, eax
mov rdi, rbp
mov rsi, rbp
mov DWORD PTR [rip+0x2d15], eax # g_vsyscall = 0
mov rax, 0xffffffffff600000
call rax
mov DWORD PTR [rip+0x2d02], 1 # g_vsyscall = 1
mov eax, DWORD PTR ds:0xffffffffff600000
mov DWORD PTR [rip+0x2cf1], 2 # g_vsyscall = 2
mov edi, [rip+0x2ceb] # exit(g_vsyscall)
call exit

Note: fixed proc-empty-vm test oopses 5.19.0-28-generic kernel
but this is separate story.

Link: https://lkml.kernel.org/r/Y7h2xvzKLg36DSq8@p183
Fixes: 5bc73bb3451b9 ("proc: test how it holds up with mapping'less process")
Signed-off-by: Alexey Dobriyan <[email protected]>
Reported-by: Mirsad Goran Todorovac <[email protected]>
Tested-by: Mirsad Goran Todorovac <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...


Revision tags: v6.2-rc2, v6.2-rc1, v6.1, v6.1-rc8, v6.1-rc7, v6.1-rc6, v6.1-rc5, v6.1-rc4, v6.1-rc3, v6.1-rc2, v6.1-rc1
# 5bc73bb3 05-Oct-2022 Alexey Dobriyan <[email protected]>

proc: test how it holds up with mapping'less process

Create process without mappings and check

/proc/*/maps
/proc/*/numa_maps
/proc/*/smaps
/proc/*/smaps_rollup

They must be empty (excluding v

proc: test how it holds up with mapping'less process

Create process without mappings and check

/proc/*/maps
/proc/*/numa_maps
/proc/*/smaps
/proc/*/smaps_rollup

They must be empty (excluding vsyscall page) or full of zeroes.

Retroactively this test should've caught embarassing /proc/*/smaps_rollup
oops:

[17752.703567] BUG: kernel NULL pointer dereference, address: 0000000000000000
[17752.703580] #PF: supervisor read access in kernel mode
[17752.703583] #PF: error_code(0x0000) - not-present page
[17752.703587] PGD 0 P4D 0
[17752.703593] Oops: 0000 [#1] PREEMPT SMP PTI
[17752.703598] CPU: 0 PID: 60649 Comm: cat Tainted: G W 5.19.9-100.fc35.x86_64 #1
[17752.703603] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./X99 Extreme6/3.1, BIOS P3.30 08/05/2016
[17752.703607] RIP: 0010:show_smaps_rollup+0x159/0x2e0

Note 1:
ProtectionKey field in /proc/*/smaps is optional,
so check most of its contents, not everything.

Note 2:
due to the nature of this test, child process hardly can signal
its readiness (after unmapping everything!) to parent.
I feel like "sleep(1)" is justified.
If you know how to do it without sleep please tell me.

Note 3:
/proc/*/statm is not tested but can be.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>

show more ...