<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/testing/selftests/proc, branch v4.19</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.19</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.19'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2018-08-22T17:52:45Z</updated>
<entry>
<title>proc: test /proc/thread-self symlink</title>
<updated>2018-08-22T17:52:45Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-08-22T04:54:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2cd36fb329487e9525db3ccdbac1e92053b646fa'/>
<id>urn:sha1:2cd36fb329487e9525db3ccdbac1e92053b646fa</id>
<content type='text'>
Same story: I have WIP patch to make it faster, so better have a test
as well.

Link: http://lkml.kernel.org/r/20180627195209.GC18113@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: test /proc/self symlink</title>
<updated>2018-08-22T17:52:45Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-08-22T04:54:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=61d47c4e71c1f080e7412315c8685bc682a8e53a'/>
<id>urn:sha1:61d47c4e71c1f080e7412315c8685bc682a8e53a</id>
<content type='text'>
There are plans to change how /proc/self result is calculated,
for that a test is necessary.

Use direct system call because of this whole getpid caching story.

Link: http://lkml.kernel.org/r/20180627195103.GB18113@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tools/testing/selftests/proc: test /proc/*/fd a bit (+ PF_KTHREAD is ABI!)</title>
<updated>2018-06-08T00:34:38Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-06-08T00:10:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b2f5de0334f03e90ae7dee72a7fc597ef555a9a8'/>
<id>urn:sha1:b2f5de0334f03e90ae7dee72a7fc597ef555a9a8</id>
<content type='text'>
* Test lookup in /proc/self/fd.
  "map_files" lookup story showed that lookup is not that simple.

* Test that all those symlinks open the same file.
  Check with (st_dev, st_info).

* Test that kernel threads do not have anything in their /proc/*/fd/
  directory.

Now this is where things get interesting.

First, kernel threads aren't pinned by /proc/self or equivalent,
thus some "atomicity" is required.

Second, -&gt;comm can contain whitespace and ')'.
No, they are not escaped.

Third, the only reliable way to check if process is kernel thread
appears to be field #9 in /proc/*/stat.

This field is struct task_struct::flags in decimal!
Check is done by testing PF_KTHREAD flags like we do in kernel.

	PF_KTREAD value is a part of userspace ABI !!!

Other methods for determining kernel threadness are not reliable:
* RSS can be 0 if everything is swapped, even while reading
  from /proc/self.

* -&gt;total_vm CAN BE ZERO if process is finishing

	munmap(NULL, whole address space);

* /proc/*/maps and similar files can be empty because unmapping
  everything works. Read returning 0 can't distinguish between
  kernel thread and such suicide process.

Link: http://lkml.kernel.org/r/20180505000414.GA15090@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: fixup copyright sign</title>
<updated>2018-04-13T03:52:25Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-04-12T20:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ee9294d6ddbd418807ae49f4ab4e6441c9da2a18'/>
<id>urn:sha1:ee9294d6ddbd418807ae49f4ab4e6441c9da2a18</id>
<content type='text'>
Add copyright in two files before they get autorubberstamped.

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: selftests: test /proc/uptime</title>
<updated>2018-04-11T17:28:34Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-04-10T23:43:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1f5bd0547654ada423b184e22f320d76c0fac49e'/>
<id>urn:sha1:1f5bd0547654ada423b184e22f320d76c0fac49e</id>
<content type='text'>
The only tests I could come up with for /proc/uptime are:
 - test that values increase monotonically for 1 second,
 - bounce around CPUs and test the same thing.

Avoid glibc like plague for affinity given patches like this:
https://marc.info/?l=linux-kernel&amp;m=152130031912594&amp;w=4

Link: http://lkml.kernel.org/r/20180317165235.GB3445@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: selftests: shotgun testing of read/readdir/readlink/write</title>
<updated>2018-04-11T17:28:34Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-04-10T23:46:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=05c3f29283af9e3da0ab7414f666cb37f530950a'/>
<id>urn:sha1:05c3f29283af9e3da0ab7414f666cb37f530950a</id>
<content type='text'>
Perform reads with nearly everything in /proc, and some writing as well.

Hopefully memleak checkers and KASAN will find something.

[adobriyan@gmail.com: /proc/kmsg can and will block if read under root]
  Link: http://lkml.kernel.org/r/20180316232147.GA20146@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
[adobriyan@gmail.com: /proc/sysrq-trigger lives on the ground floor]
  Link: http://lkml.kernel.org/r/20180317164911.GA3445@avx2
Link: http://lkml.kernel.org/r/20180315201251.GA12396@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: add selftest for last field of /proc/loadavg</title>
<updated>2018-04-11T17:28:34Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-04-10T23:42:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5de3d401b79486b9323e1be30e3a34c2437b8800'/>
<id>urn:sha1:5de3d401b79486b9323e1be30e3a34c2437b8800</id>
<content type='text'>
Test fork counter formerly known as -&gt;last_pid, the only part of
/proc/loadavg which can be tested.

Testing in init pid namespace is not reliable because of background
activity.

Link: http://lkml.kernel.org/r/20180311152241.GA26247@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: fix /proc/*/map_files lookup some more</title>
<updated>2018-04-11T17:28:34Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-04-10T23:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=35318db566e18ee3ada7e2d62192e5e87b1b5e4b'/>
<id>urn:sha1:35318db566e18ee3ada7e2d62192e5e87b1b5e4b</id>
<content type='text'>
I totally forgot that _parse_integer() accepts arbitrary amount of
leading zeroes leading to the following lookups:

		OK
	# readlink /proc/1/map_files/56427ecba000-56427eddc000
	/lib/systemd/systemd

		bogus
	# readlink /proc/1/map_files/00000000000056427ecba000-56427eddc000
	/lib/systemd/systemd
	# readlink /proc/1/map_files/56427ecba000-00000000000056427eddc000
	/lib/systemd/systemd

Link: http://lkml.kernel.org/r/20180303215130.GA23480@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Reviewed-by: Cyrill Gorcunov &lt;gorcunov@gmail.com&gt;
Reviewed-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Pavel Emelyanov &lt;xemul@virtuozzo.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: test /proc/self/syscall</title>
<updated>2018-04-11T17:28:34Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-04-10T23:31:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c4219edf1de2af44fd98903f72f6e1ceb7f3c701'/>
<id>urn:sha1:c4219edf1de2af44fd98903f72f6e1ceb7f3c701</id>
<content type='text'>
Read from /proc/self/syscall should yield read system call and correct
args in the output as current is reading /proc/self/syscall.

Link: http://lkml.kernel.org/r/20180226212145.GB742@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: test /proc/self/wchan</title>
<updated>2018-04-11T17:28:34Z</updated>
<author>
<name>Alexey Dobriyan</name>
<email>adobriyan@gmail.com</email>
</author>
<published>2018-04-10T23:31:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9cd65655585523adecd65b750e1537cdea84718e'/>
<id>urn:sha1:9cd65655585523adecd65b750e1537cdea84718e</id>
<content type='text'>
This patch starts testing /proc.  Many more tests to come (I promise).

Read from /proc/self/wchan should always return "0" as current is in
TASK_RUNNING state while reading /proc/self/wchan.

Link: http://lkml.kernel.org/r/20180226212006.GA742@avx2
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
