<pie_>
i dont really understand the user-mode linux skas0 execution model...
<nikolar>
i don't even know what that is, so you have one up on me
<pie_>
its...the way the host side mapping is implemented
<pie_>
there's 3 variations
<pie_>
skas0 is the "newest" one;
<pie_>
theres one called tt for thread tracing or something, one called skas3, (skas is "separate kernel address space(s?)", whatever that means) , and one calles skas0 - where the 0 is for "needs zero host kernel patches"
<clever>
pie_: "whatever that means", its related to preventing the guest userland from accessing the kernel memory, which is also host userland memory
<nikolar>
How does that work
<clever>
nikolar: thats the part i'm fuzzy on, and it sounds like the 3 variants do it differently
<clever>
but the "separate kernel address space" in skas, implies something like maybe having the kernel in a dedicated process, and IPC'ing between the fake userland and fake kernel?
<pie_>
the part everyone is fuzzy on
<pie_>
anyway it shoudl clear up for you , its explained in the book one sec
<pie_>
look at him guessing it<clever> but the "separate kernel address space" in skas, implies something like maybe having the kernel in a dedicated process, and IPC'ing between the fake userland and fake kernel?
<bslsk05>
xeiaso.net: Making sure you're not a bot!
<clever>
ah wait, there is an extra rootfs=, thats perfect
<clever>
hostfs*
<nikolar>
extra?
<clever>
so you can just do: ./linux rootfstype=hostfs rw init=/bin/bash rootfs=root/
<clever>
and then just drop a bash at root/bin/bash
<pie_>
Open alpinelinux.org. Click on Downloads. Scroll down to where it lists the MINI ROOT FILESYSTEM. Right-click on the x86_64 link and copy it. As of the time of writing this post, the latest URL for this is:
<clever>
it also clearly says, that it can handle ext2/3/4
<nikolar>
indeed it does
<nikolar>
ok well one mystery solved
<nikolar>
it wasn't configured with ubd support lol
<nikolar>
i can get into the image now
<clever>
thatll do it!
<nikolar>
yup heh
<nikolar>
now i just need to figure out a 64 bit kernel
<nikolar>
and the hostfs weirdness
<clever>
i suspect that hostfs may not be a prefix but a filter
<clever>
basically, if you set hostfs=/home/clever, then the guest must do `mount -t hostfs /home/clever/foo /anywhere`
<nikolar>
right, who knows
<clever>
maybe you can do `root=$(realpath root)` ?
<clever>
and hostfs isnt needed, its purely to restrict it
<clever>
along with rootfstype=hostfs
<nikolar>
yea
<nikolar>
that does seem to be working
<nikolar>
ok 64 bit was a different config option apparentyl
<nikolar>
let's see if it works now
<nikolar>
yup, 64 bit works now
<clever>
can you now run the host bash, and run uml within uml? lol
<nikolar>
i can run the host bash
<nikolar>
i doubt i can run uml in uml
<nikolar>
because ptrace lol
<nikolar>
i am running the alpine image from earlier though
da5id has quit [Quit: WeeChat 4.7.0]
karenw has quit [Ping timeout: 245 seconds]
j00ru has quit [Ping timeout: 248 seconds]
criswell has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
j00ru has joined #osdev
skipwich has quit [Remote host closed the connection]
skipwich_ has joined #osdev
skipwich_ is now known as skipwich
criswell has joined #osdev
criswell has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fgarcia has joined #osdev
fgarcia has quit [Max SendQ exceeded]
criswell has joined #osdev
criswell has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
steelswords94361 has quit [Quit: Ping timeout (120 seconds)]
steelswords94361 has joined #osdev
steelswords94361 has quit [Quit: Ping timeout (120 seconds)]
steelswords94361 has joined #osdev
goliath has joined #osdev
_whitelogger has joined #osdev
<ZetItUp>
it's too early in the morning, didn't get any sound from spotify, started troubleshooting everything, even reinstalled drivers... it was muted.
agent314 has joined #osdev
netbsduser has joined #osdev
GeDaMo has joined #osdev
steelswords94361 has quit [Quit: Ping timeout (120 seconds)]
steelswords94361 has joined #osdev
Lucretia has joined #osdev
agent314 has quit [Ping timeout: 276 seconds]
<nikolar>
Oh no
<zid>
nikolar found a mirror
<nikolar>
:|
<Mutabah>
zid: Oof, that's cold
<zid>
It was understated and subtle, compared to what he actually looks like Mutabah
xvmt has quit [Read error: Connection reset by peer]
xvmt has joined #osdev
bauen1 has quit [Ping timeout: 252 seconds]
Teukka has quit [Read error: Connection reset by peer]
Teukka has joined #osdev
Left_Turn has joined #osdev
<nikolar>
trying to boot my distro on top of uml now
<nikolar>
i don't get a console on tty0 though :(
<heat>
uml is barely used
<heat>
i will be surprised if it works
<nikolar>
it does
<nikolar>
it gets through the boot process, mostly
<nikolar>
i can't check how far because i don't get a bash prompt
netbsduser has quit [Ping timeout: 276 seconds]
kristinam has quit [Server closed connection]
kristinam has joined #osdev
goliath has quit [Remote host closed the connection]
goliath has joined #osdev
sortiecat has joined #osdev
criswell has joined #osdev
vdamewood has quit [Quit: Life beckons]
bauen1 has joined #osdev
EmanueleDavalli has joined #osdev
Brnocrist has quit [Ping timeout: 252 seconds]
Brnocrist has joined #osdev
sortiecat has quit [Quit: Leaving]
vdamewood has joined #osdev
<klys>
ok, if i made a chroot and mounted -t devtmpfs none /dev; in that chroot, then proceeded to rm -r dev; and came back to find most of /dev missing outside the chroot, proceeding to mknod /dev/nvme0n1 b 259 0; and find a disk image completely zeroed out, except it's still mounted and my data appears to be intact through the mount, is it safe to reboot?
<nikolar>
huh well
criswell has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<heat>
> proceeded to rm -r dev
<heat>
don't do that
<heat>
> and came back to find most of /dev
<heat>
yes that's what happens
<heat>
> mknod /dev/nvme0n1 b 259 0
<heat>
is the device number correct? are you sure it's all zeroed out?
<zid>
yea that was my only thought
<zid>
that that's j ust the wrong node
EmanueleDavalli has quit [Read error: Connection reset by peer]
<pog>
oops
<AmyMalik>
... xD?
EmanueleDavalli has joined #osdev
EmanueleDavalli has quit [Read error: Connection reset by peer]
<nikolar>
oh i have a mostly booted linux environment using uml kek
<nikolar>
even has networking!
<zid>
underwear mode linux
<nikolar>
kek i got this cursed thing working well enough that i can ssh into it as a regular user
<heat>
under linux kernel operating mode linux
edr has joined #osdev
<nikolar>
yes
<kof673>
all this uml talk but not a diagram in sight
<kof673>
strange new world
<nikolar>
we don't do that kind of uml here
<nikolar>
we aren't JAVA ENTERPRISE CLASS HIERARCHY enouhg
<zid>
nikolar loves a diagram normally
<zid>
in crayon, mainly
<heat>
KernalFactory
<nikolar>
kek uml is running the newer kernel than my hos
<nikolar>
host
<heat>
your hos
<heat>
they use linux??
<zid>
uml is for power-bottoms right?
<nikolar>
it's so cursed, i love it
<zid>
That's a yes
<nikolar>
i don't even know what you said, so sure
<kof673>
maybe the uml joke was all these diagrams and not a line of code in sight /s
<nikolar>
huh til that python isn't in base arch packages
<heat>
really?
<heat>
that's pretty rare
<nikolar>
it's probably gets pulled immediatelly with some other random package you install quickly
<nikolar>
but it isn't, apparently
<zid>
portage :(
<nikolar>
portage?
<nikolar>
s/it's/it/
<bslsk05>
<nikolar*> it probably gets pulled immediatelly with some other random package you install quickly
<zid>
gentoo's package manager, it's written in python
<pog>
i wrote a threaded version of sha1sum in like 2009
<pog>
wasn't that much faster and sometimes slower
<zid>
is that even... possible
<nikolar>
yeah i don't remember the details, but i don't expect it to be very paralellizible
<pog>
one thread per input stream
<nikolar>
it even works in relatively small chunks
<nikolar>
oh that heh
<pog>
it's not--it's entirel I/O bound
<zid>
-j16 is cheating
<nikolar>
kek
<nikolar>
very much
<pog>
iirc it would speed up dramatically on subsequent iterations of small files that would remain in the block cache
<pog>
but that's not a likely usage scenario
<zid>
but was the binary 4MB and did it take 30GB of diskspace to build
<pog>
it wasn't in rust
<zid>
and offer no way to debug it
<zid>
see that's where you went wrong
<pog>
it was in C and i used the openssl sha1
<zid>
I've written md5 twice
<zid>
never sha1
<pog>
i wrote an impl of sha1 around the same time
<nikolar>
i've yoinked a 100 linux sha1 impl
<nikolar>
so it can't be that bad
<nikolar>
line, not linux
<zid>
they're all the same
<zid>
xor some bits together and shuffle some arrays of b ytes
<pog>
yeh it's always going to be faster than IO unless the compiler is incredibly stupid/malicious
<zid>
depends what type of hash it is
<nikolar>
have you tried tcc?
<zid>
checksum hashes are designed to be quick though
<zid>
but like, password hashes *should* be slow
<pog>
yeh not crypto hashes
<pog>
totally different animal
<heat>
nikolar: ONE HUNDRED LINUX?!?
<heat>
OH MAN THAT'S THE DREAM
<nikolar>
ALL OF THE LINUCES
<heat>
aktshually
<heat>
no
<nikolar>
[nikola@uml ~]$ uname -a
<nikolar>
Linux uml 6.15.9-uml #27 Thu Aug 7 14:53:51 CEST 2025 x86_64 GNU/Linux
<nikolar>
how do you like my uml kernel
<heat>
$ git tag | wc -l
<heat>
894
<heat>
we would need ONE THOUSAND LINUX
<heat>
and it still wouldn't be enough for stable
<heat>
considering LTS consumes some 300 or so tags each
<heat>
TEN THOUSAND LINUX would be safer
<heat>
maybe ONE HUNDRED THOUSAND LINUX
<heat>
nikolar: not a fan sorry
<nikolar>
Hey it's running a full distro now!
<pie_>
<nikolar> i doubt i can run uml in uml
<pie_>
<nikolar> because ptrace lol
<pie_>
im not so sure about this
<zid>
hehe pee trace
<pie_>
the inner kernels ptrace might not be in the same scope as the outer kernels ptrace
<pie_>
zid: ...hehe
<pie_>
no water brb drinking my own kernel
<nikolar>
Only one process can ptrace a different process
<nikolar>
> UML was originally designed for the x86 instruction set, but has also been ported to others including IA-64 and PowerPC. [citation needed]
<nikolar>
heat, it's been ported to itanium! ^
<AmyMalik>
owoe?
<nikolar>
owoe?
<pog>
uwue
<nikolar>
huehue
criswell has joined #osdev
<pie_>
yes but the _inner_ ptrace is not the same ptrace? <nikolar> Only one process can ptrace a different process
<nikolar>
hm i wonder how it's implemented
<nikolar>
i still don't think it would work
<pie_>
im not saying it would, im just not sure it wouldnt
<pie_>
the question is does the inner system doing syscalls work
<zid>
I'm assuming all the missing apostrophes go like 'im
<zid>
It's more fun for me this way
<pie_>
fuck 'im
* pie_
grug brained os developer
goliath has quit [Quit: SIGSEGV]
<nikolar>
sure, but guest processes are still isolated and spawned into separate host processes
<nikolar>
which means you need actual ptrace to mess with them
<pie_>
i dont follow, but the syscall instruction is still a syscall instruction, so first the outer ptrace should get triggered
<pie_>
my question is does it then get routed to the inner ptrace handler
<pie_>
not explicitly by "i am the outer ptracer and i should give it ot the inner ptracer", but by "the handler for this event coincidentally happens to be the handler for ptrace in the inner kernel"
<nikolar>
so both the outer guest and the inner guest are going to want to spawn host processes (outer directly, inner indirectly, but through outer)
<pie_>
yeah
<nikolar>
which means that outer will already have attached its ptrace to the inner's processes
<nikolar>
and inner can't attach its ptrace
<pie_>
but the inner ptrace goes through the inner kernel? it doesnt call an outer ptrace?
<pie_>
the outer world knows nothing about the inner worlds API [citation needed]
<nikolar>
i am not saying it does
<nikolar>
but it will need to manage its processes
<pie_>
<kof673> all this uml talk but not a diagram in sight
<nikolar>
this uml is more fun anyway
<nikolar>
screw uml
<zid>
syscalls are allowed to fail because of resources not being available
<zid>
I expect ptrace-ptrace-ptrace stacking to just stop working at one level
<nikolar>
yea same
<nikolar>
which is to say, no nesting uml
<heat>
kof673: lol
<heat>
underrated joke
<nikolar>
oh you missed it earlier kek
<pie_>
nikolar: i dont understand, but you are probably correct nevertheless
<nikolar>
lol why
<nikolar>
(why do you assume i am that is)
<zid>
niko niko niko lar, anata ga omou yori kenou desu
<zid>
niko niko niko lar, atama no deki ga chigau no de mondai wa nashi
<bslsk05>
'Nico Nico Nii Remix 10 hs' by Tute Cisterna
<nikolar>
lol where did you get that from
<zid>
you were literally talking about wanting to go to a concert where that would be the #1 song and you don't recognise it, smh
<nikolar>
kek
<pie_>
he will break your nico nico kneecaps if you dont stop throwing shade
<nikolar>
pie_: don't worry about him, he's just like taht
<pie_>
no nico nico niicap breaking? :(
* pie_
dejectedly puts away the knuckledusters
<zid>
nikolar: Did you figure out what it is yet lol
<nikolar>
nope
<zid>
wow even with the hint
<zid>
that's nuts
<zid>
ado - usseewa
<nikolar>
i don't know the bloody lyrics lol
<zid>
yea but I gave you AN HINT
<nikolar>
you did, yea
<zid>
ado is the person's concert you mentioned, and usseewa has.. 400 million youtube hits
<nikolar>
it is
<nikolar>
but not my favourite song so i haven't listened to it enough to remember the lyrics
<nikolar>
kek
<zid>
the lyrics are niko niko niko lar
<zid>
then yo mumble and shout NASHI
<nikolar>
kek
[Kalisto] has quit [Quit: No' vemo']
[Kalisto] has joined #osdev
bauen1 has quit [Ping timeout: 276 seconds]
flx has quit [Server closed connection]
fsinger has joined #osdev
kata has joined #osdev
PublicWiFi has quit [Ping timeout: 276 seconds]
netbsduser has joined #osdev
mavhq has quit [Ping timeout: 252 seconds]
mavhq has joined #osdev
PublicWiFi has joined #osdev
da5id has joined #osdev
FreeFull has quit [Ping timeout: 272 seconds]
c0co has joined #osdev
bauen1 has joined #osdev
xenos1984 has quit [Ping timeout: 252 seconds]
xenos1984 has joined #osdev
<pie_>
huh. well i suppose.
<pie_>
helper thread and the SIGIO helper thread. Running ptrace on this thread usually results in the following picture:"
<pie_>
docs.kernel.org/virt/uml/user_mode_linux_howto_v2.html "Tracing UMLWhen running, UML consists of a main kernel thread and a number of helper threads. The ones of interest for tracing are NOT the ones that are already ptraced by UML as a part of its MMU emulation.These are usually the first three threads visible in a ps display. The one with the lowest PID number and using most CPU is usually the kernel thread. The other threads are the disk (ubd) device
<bslsk05>
docs.kernel.org: UML HowTo — The Linux Kernel documentation
<zid>
PICTURE TO FOLLOW. STOP.
<clever>
pie_: as a rough guess, i can see how you might use ptrace on the guest userland processes, and rig it up to only halt on attempted syscall
<clever>
then the debugging process (the kernel) can do the syscall in userland, and use ptrace to fake the reply
<clever>
i dont see why ptrace is needed for mmu emulation, just use ptrace to forcibly call mmap() in each guest
vdamewood has quit [Quit: Life beckons]
xenos1984 has quit [Ping timeout: 252 seconds]
xenos1984 has joined #osdev
<nikolar>
clever: I don't know if you've seen earlier but I managed to boot a full distro
<nikolar>
And got networking working enough to install packages and even ssh into it
<pie_>
<derRichard> it's upstream, these days uml can use ptrace or seccomp
<pie_>
<pie_> oh, so i did tread that somewhere then lol
<bslsk05>
patchwork.ozlabs.org: [v2,0/8] SECCOMP based userspace for UML - Patchwork
<nikolar>
It's cute that someone's still actively working on it
<nikolar>
I like it
<klys>
heat, the device file /dev/nvme0n1 starts with a bunch of zeroes and is zeroes appreciably throughout as far as I'd checked. yes, no partition table is visible. however I have two nvme drives here, and nvme1n1 should be valid: in /proc/swaps it shows: /dev/nvme1n1\040(deleted) partition 1953514580 77568 -2 The device name reported at fdisk -l is not correct for /dev/nvme0n1 but for /dev/nvme1n1; from
<heat>
note that devices start at 0, namespaces start at 1
<nikolar>
for some reason
<heat>
the reason is quite simple
<heat>
nvme specifies that namespace ids start at 1 and 0 is invalid
<heat>
they can even be discontiguous
<nikolar>
so it's nvme spec's fault
<heat>
yeah
<nikolar>
is there a particular reason why 0 is invalid
<heat>
dunno
<nikolar>
is it a sentinel value or sometihng
<heat>
maybe they needed an invalid one for the protocol, and between 0 and something like -1 they picked 0
<nikolar>
you wrote a nvme driver so that's why i iask
<heat>
i wrote two nvme drivers
<nikolar>
show off
<heat>
:)
<heat>
nvme0n2, nvme0n4 is a valid listing for a controller with an inactive namespace 1, active 2, inactive 3, active 4
<geist>
daaaaamn heat
<geist>
you are an nvme player
<nikolar>
he isn't a dvd player though
<nikolar>
head i did a cursed
<nikolar>
erm, geist i meant
<nikolar>
heat already knows
bl4ckb0ne has quit [Server closed connection]
bl4ckb0ne has joined #osdev
<klys>
10, 258 Aug 7 04:54 /dev/nvme-fabrics; 242, 0 Aug 7 04:56 /dev/nvme0; 259, 1 Aug 7 14:13 /dev/nvme0n1; 259, 2 Aug 7 14:16 /dev/nvme0n1p1; 259, 3 Aug 7 14:16 /dev/nvme0n1p2; 259, 4 Aug 7 14:16 /dev/nvme0n1p3; 259, 5 Aug 7 14:16 /dev/nvme0n1p4; 259, 6 Aug 7 14:16 /dev/nvme0n1p5; 259, 7 Aug 7 14:17 /dev/nvme0n1p6; 259, 0 Aug 7 14:14 /dev/nvme1n1
<klys>
it all checks out now.
<heat>
ah you're doing fabrics
<klys>
swaps are reenabled
<heat>
geist: i used onyx's nvme driver as a source for the one i wrote for work raisins :P
<heat>
(and found a bug in the process, which I'm yet to fix)
<nikolar>
why'd you need to write a nvme driver at work
<heat>
nvme-over-tcp support for OVMF
<nikolar>
fancy
<nikolar>
so your code is in ovmf then
<heat>
no, not yet
<heat>
needs to be further finished and upstreamed
<heat>
but the protocol really is quite cool
<nikolar>
it's in the pipeline though
<heat>
you can vaguely share most of the code between the various NVMe backends if you're smart about things
<nikolar>
define vaguely
<heat>
vaguely is only vaguely defined :P
<nikolar>
kek
<heat>
e.g instead of the CC enable bit being toggled manually with some volatile access or something, you can have nvme_write(REG_CC, nvme_read(REG_CC) | EN) with some error checking
<heat>
and boom, it ok works for NVMe-over-PCIe, NVMe-over-TCP, NVMe-over-FC
<heat>
because it's the exact same startup sequence
<heat>
commands are all exactly the same
<heat>
the only things that change are the way to setup queues, and the way to submit stuff to those queues
<heat>
so what you see in linux is the different backends sharing the core NVMe driver, and in bits where you need high performance (IO submission) they simply use the NVMe core as a bit of a library, without any indirect calls or whatnot
<nikolar>
makes sense i guess
<heat>
also fun fact linux can act as an nvme PCIe controller
<nikolar>
what do you mean
dennisschagt has quit [Server closed connection]
dennisschagt has joined #osdev
<geist>
as a pci device node? makes sense probably for some embedded situations
<heat>
yeah it can serve as an endpoint
Gooberpatrol66 has quit [Quit: Konversation terminated!]
Gooberpatrol66 has joined #osdev
gf34 has joined #osdev
pie_ is now known as ketchie_
ketchie_ is now known as pie_
gf3 has quit []
gf34 is now known as gf3
<heat>
> This driver has been extensively tested using a Radxa Rock5B board
<heat>
nikolar: oh hey didn't you have one?
karenw has joined #osdev
bauen1 has quit [Ping timeout: 265 seconds]
<nikolar>
i do yea
<nikolar>
wait was it 5a
<nikolar>
i forgor
<nikolar>
what driver, the nvme stuff you were talking about?
<heat>
yeah
<heat>
ah i think you need an endpoint controller
<nikolar>
what for
<heat>
for endpointin
runxiyu has quit [Server closed connection]
runxiyu has joined #osdev
<nikolar>
of course
frkzoid has quit [Ping timeout: 260 seconds]
criswell has joined #osdev
lanodan has quit [Ping timeout: 252 seconds]
lanodan has joined #osdev
Lucretia has quit [Remote host closed the connection]
monkeyPlus has joined #osdev
jimbzy has quit [Server closed connection]
<pie_>
what about controllerin?
<pie_>
hi guys im stupid and i dont like it
nyah has quit [Remote host closed the connection]
nyah has joined #osdev
karenw has quit [Ping timeout: 276 seconds]
monkeyPlus has quit [Remote host closed the connection]