From 5c6adae24c8485fd882a10d76933bdba286882b1 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Tue, 15 Feb 2022 21:19:27 +0000 Subject: Final nmount post --- md/writeup.md | 1 + md/writeup/writing_linux_mount_utility.md | 31 +++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/md/writeup.md b/md/writeup.md index 846bfbf..7434954 100644 --- a/md/writeup.md +++ b/md/writeup.md @@ -4,6 +4,7 @@ title: Writeup page ## Writeup's +[Writing linux mount utility](writeup/writing_linux_mount_utility.md) [Naive FFT implementation in C](writeup/naive_fft_implementation_in_c.md) [Web assembly audio with fir filter](writeup/web_assembly_audio_with_fir_filter.md) [Calculate fir coefficients with C](writeup/calculate_fir_coefficients_with_c.md) diff --git a/md/writeup/writing_linux_mount_utility.md b/md/writeup/writing_linux_mount_utility.md index 9b71a84..05d3770 100644 --- a/md/writeup/writing_linux_mount_utility.md +++ b/md/writeup/writing_linux_mount_utility.md @@ -11,7 +11,7 @@ own mount utility. As its looks like only one syscall is needed to do that sys_m Other part of it is to see how to get all different file systems and find options that are possible to pass to mounted partition. All of this also preparations to write my own linux userspace and to have non-Linux distro. Main inspiration -taken form arsv/minibase soure code. +taken form arsv/minibase soure code. ## Syscalls @@ -46,7 +46,7 @@ Comparison to mount utility is straigforward. ### Supported filesystems -Rund command to find filesystems supported by currently running kernel +Run command to find filesystems supported by currently running kernel ``` cat /proc/filesystems @@ -115,14 +115,34 @@ I spend some time to find all params that are supported for procfs,devtmps and t | hidepid | __0__ - Everybody may access all proc, __1__ - User can access only their own proc, not other /proc/[pid], __2__ - As for mode 1, extra hides pid directories of others | | gid | usergroup who sees /proc in mode 0 | -### Devtmpfs +## Examples +### Mount proc +```bash +nmount_static -t proc -d ma_proc -f hidepid=0 -v +``` + +### Mount mqueue -### Tempfs +```bash +nmount_static -t mqueue -d ma_quque -f noexec -v +``` +### Mount devtmpfs +```bash +mount_static -t devtmpfs -d mq_dev -f noexec -v +``` -## Implementation +### Mount tmpfs +```bash +nmount_static -t mqueue -d ma_ram -f noexec -v +``` + +### Mount sysfs +```bash +nmount_static -t sysfs -d ma_sys -f silent -v +``` ## Links @@ -139,7 +159,6 @@ https://man7.org/linux/man-pages/man7/file-hierarchy.7.html [procsf] https://www.man7.org/linux/man-pages/man5/proc.5.html https://elixir.bootlin.com/linux/v4.14.184/source/fs/proc/root.c#L33 -[tmpfs] https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt -- cgit v1.2.3