Skip to contentSkip to conversation

proc: exit correctly in /proc/*/maps test

PATCH New Alexey Dobriyan 1 participant 2 messages Feb 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 proc: exit correctly in /proc/*/maps test

If open() or writev() fails, test will hang waiting for child test process.

---

fold into proc-test-proc-maps-smaps-smaps_rollup-statm.patch

 tools/testing/selftests/proc/proc-pid-vm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/proc/proc-pid-vm.c +2 -2
@@ -189,11 +189,11 @@ static int make_exe(const uint8_t *payload, size_t len)
 
 	fd = openat(AT_FDCWD, "/tmp", O_WRONLY|O_EXCL|O_TMPFILE, 0700);
 	if (fd == -1) {
-		return 1;
+		exit(1);
 	}
 
 	if (writev(fd, iov, 3) != sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + len) {
-		return 1;
+		exit(1);
 	}
 
 	/* Avoid ETXTBSY on exec. */
#1 lore raw

PATCH 2/2 proc: use ramfs for executable generation

tmpfs is under CONFIG_TMPFS which can be disabled. ramfs is always enabled.

---

fold into proc-test-proc-maps-smaps-smaps_rollup-statm.patch

 tools/testing/selftests/proc/proc-pid-vm.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/proc/proc-pid-vm.c +1 -2
@@ -20,7 +20,6 @@
  * Test /proc/$PID/smaps_rollup
  * Test /proc/$PID/statm
  *
- * FIXME require CONFIG_TMPFS which can be disabled
  * FIXME test other values from "smaps"
  * FIXME support other archs
  */
@@ -58,7 +57,7 @@ static void make_private_tmp(void)
 	if (mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL) == -1) {
 		exit(1);
 	}
-	if (mount(NULL, "/tmp", "tmpfs", 0, NULL) == -1) {
+	if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1) {
 		exit(1);
 	}
 }