tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/damon/sysfs_memcg_path_leak.sh- Extension
.sh- Size
- 945 bytes
- Lines
- 46
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
if [ $EUID -ne 0 ]
then
echo "Run as root"
exit $ksft_skip
fi
damon_sysfs="/sys/kernel/mm/damon/admin"
if [ ! -d "$damon_sysfs" ]
then
echo "damon sysfs not found"
exit $ksft_skip
fi
kmemleak="/sys/kernel/debug/kmemleak"
if [ ! -f "$kmemleak" ]
then
echo "$kmemleak not found"
exit $ksft_skip
fi
# ensure filter directory
echo 1 > "$damon_sysfs/kdamonds/nr_kdamonds"
echo 1 > "$damon_sysfs/kdamonds/0/contexts/nr_contexts"
echo 1 > "$damon_sysfs/kdamonds/0/contexts/0/schemes/nr_schemes"
echo 1 > "$damon_sysfs/kdamonds/0/contexts/0/schemes/0/filters/nr_filters"
filter_dir="$damon_sysfs/kdamonds/0/contexts/0/schemes/0/filters/0"
# try to leak 128 times
for i in {1..128};
do
echo "012345678901234567890123456789" > "$filter_dir/memcg_path"
done
echo scan > "$kmemleak"
kmemleak_report=$(cat "$kmemleak")
if [ "$kmemleak_report" = "" ]
then
exit 0
fi
echo "$kmemleak_report"
exit 1
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.