NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/56232: Unstable system with tar on /dev



The following reply was made to PR kern/56232; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/56232: Unstable system with tar on /dev
Date: Sun, 6 Jun 2021 05:54:46 +0000 (UTC)

 OK, I've found out which device is causing the kernel crashes.
 It's iscsi0. Running the program below as root reproducibly
 crashes my system.
 
 $ sudo ./opentest /dev/iscsi0
 /dev/iscsi0
 [ The system hangs here, then reboots ]
 
 Another issue found during this test:
 
 $ sudo find /dev/ -not \( -type f -o -name iscsi0 \) \
  	-exec ./opentest {} + 2>&1 | fgrep -B1 close
 /dev/ipmi0
 opentest: /dev/ipmi0: close failed.: Device not configured
 $
 
 ipmi(4) should fail on open()--not later on in close(), I think.
 
 Should I file a separate PR for this, or is leaving it here OK?
 
 Thanks,
 -RVP
 
 ----- START CODE -----
 /**
   * sudo ./opentest /dev/iscsi0
   *
   * sudo find /dev -not \( -type f -o -name iscsi0 \) \
   *	-exec ./opentest {} + 2>&1 | fgrep -B1 close
   */
 #include <sys/stat.h>
 #include <err.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 
 int
 main(int argc, char* argv[])
 {
  	int i, rc = EXIT_SUCCESS;
 
  	for (i = 1; i < argc; i++) {
  		char* fn = argv[i];
  		struct stat sb;
  		int fd;
 
  		printf("%s\n", fn);
  		fflush(stdout);
  		fd = open(fn, O_RDONLY | O_NONBLOCK);
  		if (fd == -1) {
  			warn("%s: open failed.", fn);
  			rc = EXIT_FAILURE;
  			continue;
  		}
  		if (fstat(fd, &sb) == -1) {
  			warn("%s: fstat failed.", fn);
  			rc = EXIT_FAILURE;
  		}
  		if (close(fd) == -1) {
  			warn("%s: close failed.", fn);
  			rc = EXIT_FAILURE;
  		}
  	}
  	return rc;
 }
 ----- END CODE -----
 


Home | Main Index | Thread Index | Old Index