home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / bsd / 4289 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.6 KB  |  54 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!news.univie.ac.at!news.tu-graz.ac.at!fstgds01!chmr
  3. From: chmr@fstgds01.tu-graz.ac.at (Christoph Robitschko)
  4. Subject: Re: Yet another way to cause a kernel panic
  5. Message-ID: <1992Aug17.190232.16999@news.tu-graz.ac.at>
  6. Sender: news@news.tu-graz.ac.at (USENET News System)
  7. Nntp-Posting-Host: fstgds01
  8. Organization: Technical University of Graz, Austria
  9. References: <16of99INNide@disaster.Germany.EU.net>
  10. Date: Mon, 17 Aug 92 19:02:32 GMT
  11. Lines: 41
  12.  
  13. In article <16of99INNide@disaster.Germany.EU.net> bs@Germany.EU.net (Bernard Steiner) writes:
  14. >Just found a nice way to cause a panic:
  15. >#include <unistd.h>
  16. >main()
  17. >{
  18. >    chroot("/bin");
  19. >    execl("./bin/sh", "-i", 0);
  20. >}
  21. >
  22. >compile; log in as root, cd / and execute program...
  23. >bin/sync syncs the disks, while bin/ls starts listing and then panics
  24. >the system. WHY ?
  25. >
  26. >Just because the process root is _above_ the process cwd is no legitimate
  27. >reason imho ;-)
  28. >
  29. >Cheers,
  30. >    Bernard
  31.  
  32. Exactly that is the reason; But it is not legitimate ;-)
  33.  
  34. Here is a n excerpt from /sys/kern/vfs_lookup.c, around line 328:
  35.  
  36.       if (ndp->ni_isdotdot) {
  37.           for (;;) {
  38. !             if (dp == ndp->ni_rootdir) {
  39.                   ndp->ni_dvp = dp;
  40.  
  41. Change the line marked with ! so that it reads:
  42.  
  43.              if ((dp == ndp->ni_rootdir) || (dp == rootdir)) {
  44.  
  45. This makes sure it never gets below the *system* root directory.
  46.  
  47.                         
  48.                         Cheers,
  49.                         Christoph
  50. -- 
  51. ------------------------------------------------------------------------
  52. Christoph M. Robitschko  | "the only man who got his work done by Friday
  53. chmr@edvz.tu-graz.ac.at  |             was Robinson Crusoe."
  54.