|
453 | 453 | \end{slide} |
454 | 454 |
|
455 | 455 | \begin{itemize} |
456 | | -\item W.r.t. setting the UID for a process with EUID == 0, see also the notes on page |
457 | | -\pageref{ROOT_SETUID}. |
| 456 | +\item W.r.t. setting the UID for a process with EUID == 0, see also the notes on |
| 457 | +page \pageref{ROOT_SETUID}. |
458 | 458 | \item To recap the above: a process with effective rights of a superuser can |
459 | 459 | arbitrarily change its identity. The rest can only switch between its real and |
460 | 460 | effective IDs. |
|
467 | 467 | \item \texttt{setgroups} is not part of UNIX~98 or UNIX~03. |
468 | 468 | \item RUID/EUID are saved in the kernel process structure and also in the so |
469 | 469 | called \emph{u-area} (see e.g. [Bach]). |
470 | | -\item If a root SUID program calls \texttt{setuid} for a UID other than 0, it can |
471 | | -no longer return the EUID to 0 (this makes sense, imagine a user logging into the |
472 | | -system). For a different behavior, \texttt{seteuid} (that sets just the EUID) would |
473 | | -have to be used. |
| 470 | +\item If a root SUID program calls \texttt{setuid} for a UID other than 0, it |
| 471 | +can no longer return the EUID to 0 (this makes sense, imagine a user logging |
| 472 | +into the system). For a different behavior, \texttt{seteuid} (that sets just the |
| 473 | +EUID) would have to be used. |
474 | 474 | \item Example: \example{setuid/screate-file.c} |
475 | 475 | \end{itemize} |
476 | 476 |
|
477 | | -\pdfbookmark[1]{file system}{filesys} |
478 | | - |
479 | | -\begin{slide} |
480 | | -\sltitle{File system} |
481 | | -\setlength{\baselineskip}{0.8\baselineskip} |
482 | | -\begin{itemize} |
483 | | -\item directories form a tree and together with files form an acyclic graph |
484 | | -(one file can have multiple references). |
485 | | -\item each directory also contains reference to itself '\texttt{.}' |
486 | | -(dot) and to its parent directory '\texttt{..}' (two dots). |
487 | | -\item using file system interfaces, it is possible to access other system |
488 | | -entities such as: |
489 | | - \begin{itemize2} |
490 | | -\setlength{\itemsep}{-3pt} |
491 | | -\setlength{\topsep}{0pt} |
492 | | - \item peripheral devices |
493 | | - \item named pipes |
494 | | - \item sockets |
495 | | - \item processes (\texttt{/proc}) |
496 | | - \item memory (\texttt{/dev/mem}, \texttt{/dev/kmem}) |
497 | | - \item pseudo files (\texttt{/dev/tty}, \texttt{/dev/fd/0},\dots) |
498 | | - \end{itemize2} |
499 | | -\item from the kernel's perspective, each regular file is an array of bytes. |
500 | | -\item all (including network) drives are connected to single tree. |
501 | | -\end{itemize} |
502 | | -\end{slide} |
503 | | - |
504 | | -\label{DEVFS} |
505 | | - |
506 | | -\begin{itemize} |
507 | | -\item Devices, files in \texttt{/proc}, terminals, memory etc. are of one type |
508 | | -- special files. More types: regular file (hardlink), directory, named pipe, |
509 | | -socket, symbolic link. |
510 | | -\item A newly created directory has 2 references to itself -- one from its parent |
511 | | -directory and one of itself, '\texttt{.}': |
512 | | - |
513 | | -\begin{verbatim} |
514 | | -$ mkdir test |
515 | | -$ ls -ld test |
516 | | -drwx------ 2 janp staff 512 Mar 23 12:46 test |
517 | | -\end{verbatim} |
518 | | - |
519 | | -\item The root user can in some systems, create a cycle in a directory structure. |
520 | | -However that might confuse file system traversal tools, hence the cyclical |
521 | | -structure is not used much. Symbolic links to directories work everywhere. |
522 | | -\item Named pipes (see page \pageref{MKFIFO}) can be used between processes |
523 | | -that do not have a ''family'' relationship. They work as unnamed pipes otherwise. |
524 | | -\item The sockets noted above are in the UNIX domain, i.e. they are used for |
525 | | -communication within one system. The INET domain sockets, used for network |
526 | | -communication (see page \pageref{NETWORKING}) are not visible in the file |
527 | | -system. |
528 | | -\item Debuggers use process images available through \texttt{/proc}. |
529 | | -On many Unix-like systems, the \texttt{/proc} tree contains information about |
530 | | -kernel and running processes in the form of text files. However, some systems |
531 | | -like Solaris, have those files in a binary form only and provide special |
532 | | -commands to read those (like \texttt{pargs}, \texttt{pldd}, etc.). |
533 | | -\item Modern Unix systems contain a special \emph{\texttt{devfs}} filesystem |
534 | | -that reflects an actual system configuration w.r.t. connected devices. E.g. |
535 | | -after connecting a USB stick, a related device will appear under \texttt{/dev}. |
536 | | -After physically disconnecting it, the item will disappear. |
537 | | -\end{itemize} |
538 | | - |
539 | 477 | \endinput |
0 commit comments