Directly access your physical memory (dev/mem)
bakhi.github.io
bakhi.github.io
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash....
> Bash handles several filenames specially when they are used in redirections, as described in the following table. If the operating system on which Bash is running provides these special files, bash will use them; otherwise it will emulate them internally with the behavior described below.
> ...
> Bash attempts to open the corresponding [...] socket.
If they persuaded the kernel devs to make some devfs way that those were real files, using the unix filesystem API, also fine.
But making something that looks like a real thing in the filesystem, but isn't usable by other programs that use the filesystem... Thats not right.
If you create a symlink to a path like /dev/udp/127.0.0.1/53 and redirect output to the symlink, a packet is not sent; the file is written as normal.
I'm guessing nobody has ever actually had a problem with this, so it's not actually a bad design choice, but I personally wouldn't have written that code. Leaky abstraction.
That being said, I’d prefer if the symlink actually worked and sent the packet.
I will quibble with you on /dev/null a little bit. /dev/null works like any other file; there is absolutely no guarantee that you can read what you wrote on any filesystem write on UNIX. You can "echo foo > regular_file" and then "cat regular_file" and it could be gone or have completely different content. Other processes writing the file, network filesystems, quantum rays, who knows. So to me, /dev/null is not unusual in that respect at all, except that that probability function that you can read what you wrote looks a little different than a regular file.
Most importantly, /dev/null isn't a construction implemented by bash. Any program on the OS sees the same behavior as your shell script. That said, this isn't really as unusual as I originally thought. You can open a file named $HOME/foo in bash and that's going to be a very different file in your C program. I do like the $ to indicate "hey this is a quirk of the programming language that's allowing this", though.
https://www.gnu.org/software/gawk/manual/gawkinet/gawkinet.h...
For example, one could run gawk under dash (scripting shell) instead of bash (interactive shell), for instance in a script.
Cacheable accesses would break that use case.
CPU got cache for caching memory
I would expect the memory access to happen through the CPU and its cache, avoiding such problems.
- root can install device drivers which have full executable run of the system anyway and do anything you can do with this device; this is also true on Windows.
- read about CONFIG_STRICT_DEVMEM - https://man7.org/linux/man-pages/man4/mem.4.html#:~:text=Sin....
- wait until you hear about `/dev/kmem`.
- it's possible to build a Linux kernel without `/dev/mem` support and also without loadable module support (I think), so if your threat model indicates this needs to be addressed it is possible.
Oddly enough, no. Or atleast last time I tried on Ubuntu I had to disable secure boot. Seemed like an easier way than to sign the build files