klange changed the topic of #osdev to: Operating System Development || Don't ask to ask---just ask! || For 3+ LoC, use a pastebin (for example https://gist.github.com/) || Stats + Old logs: http://osdev-logs.qzx.com New Logs: https://libera.irclog.whitequark.org/osdev || Visit https://wiki.osdev.org and https://forum.osdev.org || Books: https://wiki.osdev.org/Books
Stellacy has joined #osdev
spareproject is now known as Guest4808
Guest4808 has quit [Killed (silver.libera.chat (Nickname regained by services))]
spare has joined #osdev
wantyapps is now known as not_wantyapps
Turn_Left has quit [Read error: Connection reset by peer]
Arthuria has joined #osdev
not_wantyapps is now known as wantyapps
edr has quit [Quit: Leaving]
spare has quit [Remote host closed the connection]
Matt|home has quit [Quit: Leaving]
gog has quit [Quit: byee]
nadja has quit [Ping timeout: 252 seconds]
nadja has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
eddof13 has quit [Quit: eddof13]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #osdev
stolen has joined #osdev
memset has quit [Remote host closed the connection]
memset has joined #osdev
getz has quit [Read error: Connection reset by peer]
getz- has joined #osdev
Stellacy has quit [Ping timeout: 260 seconds]
heat has quit [Ping timeout: 252 seconds]
Arthuria has quit [Ping timeout: 264 seconds]
MiningMarsh has quit [Quit: ZNC 1.9.1 - https://znc.in]
MiningMarsh has joined #osdev
Stellacy has joined #osdev
Stellacy has quit [Client Quit]
memset has quit [Remote host closed the connection]
memset has joined #osdev
kfv has joined #osdev
kfv has quit [Remote host closed the connection]
kfv has joined #osdev
kfv has quit [Client Quit]
Stellacy has joined #osdev
Stellacy has quit [Quit: Leaving]
Stellacy has joined #osdev
kfv has joined #osdev
agent3142 has joined #osdev
agent3142 has quit [Max SendQ exceeded]
<azonenberg> Am I correct in saying that "bfcsel" is not a valid ARMv7-M instruction?
<azonenberg> Using arm-none-eabi-g++ (15:12.2.rel1-1) 12.2.1 20221205
<azonenberg> if i try to generate calls from Cortex-M ITCM to flash with -O0 or -Og, it creates a "veneer" thunk that does ldr.w pc, [pc] followed by a 32-bit immedite address
<azonenberg> But if I do -O1 or higher, instead
<azonenberg> i get bfcsel 0, 0x1688, 2, ne
<azonenberg> which isnt making much sense, i'm investigating if my linnker script is corrupting things somehow
goliath has joined #osdev
stolen has quit [Quit: Connection closed for inactivity]
GeDaMo has joined #osdev
pieguy128_ has joined #osdev
vdamewood has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pieguy128 has quit [Ping timeout: 252 seconds]
gamma63 has joined #osdev
netbsduser has joined #osdev
seds has joined #osdev
kfv has quit [Ping timeout: 252 seconds]
kfv has joined #osdev
netbsduser has quit [Ping timeout: 252 seconds]
kfv has quit [Remote host closed the connection]
kfv has joined #osdev
netbsduser has joined #osdev
Stellacy has quit [Quit: Leaving]
Stellacy has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zetef has joined #osdev
zetef has quit [Client Quit]
kfv has joined #osdev
kfv has quit [Remote host closed the connection]
kfv has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kfv has joined #osdev
kfv has quit [Remote host closed the connection]
kfv has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
X-Scale has joined #osdev
seds has quit [Remote host closed the connection]
kfv has joined #osdev
lucyy has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale has joined #osdev
X-Scale62 has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
Left_Turn has joined #osdev
kfv has quit [Ping timeout: 252 seconds]
kfv has joined #osdev
gamma63 has quit [Ping timeout: 256 seconds]
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 260 seconds]
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
X-Scale62 has quit [Ping timeout: 256 seconds]
kfv has joined #osdev
kfv has quit [Client Quit]
kfv has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
getz- is now known as getz
X-Scale has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
kfv has joined #osdev
kfv has quit [Remote host closed the connection]
kfv has joined #osdev
kfv has quit [Remote host closed the connection]
kfv has joined #osdev
kfv has quit [Client Quit]
frkzoid has quit [Ping timeout: 272 seconds]
toyBeaver has joined #osdev
ramenu has quit [Remote host closed the connection]
heat has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
X-Scale has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
hwpplayer1 has joined #osdev
edr has joined #osdev
Stellacy has quit [Ping timeout: 260 seconds]
spareproject has joined #osdev
gioyik has joined #osdev
hwpplayer1 has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
eddof13 has joined #osdev
<guideX> a few weeks ago, I was advised to run my programs in user mode and not kernel mode, but how do I know what mode I'm currently in
<zid> You start learning about osdev
<zid> instead of C#
goliath has quit [Quit: SIGSEGV]
gamma63 has joined #osdev
<nikolar> lel
<kof673> > Presently, they met Firmware, who was dressed in tattered rags and hobbled along propped on a thorny stick. # firmware can be spotted by the thorny stick
<Mutabah> guideX: If you're writing a kernel, then by default you're in kernel mode - until you explicitly drop those permissions and enter user mode
<zid> He hasn't written a kernel
<zid> He found a thing that lets him boot C# code
<zid> and he's been adding xneko and stuff to it
<Mutabah> aaah
xenos1984 has quit [Read error: Connection reset by peer]
gamma63 has quit [Ping timeout: 256 seconds]
gioyik has quit [Ping timeout: 260 seconds]
<netbsduser> aarch64 port of my kernel seems to be progressing nicely (at least in qemu)
xenos1984 has joined #osdev
<nikolar> neat
<netbsduser> it did run a little on a raspi 4 as well
<netbsduser> i can't do any proper testing on the pi as i don't have a driver for whatever nic it has
<netbsduser> i've only ever booted with a 9p root
<nikolar> ah nice heh
<heat> i'm improving my mount support while unfucking a bit of my namei
<heat> most of this is tedious refactor from tech debt
gioyik has joined #osdev
frkazoid333 has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
hwpplayer1 has joined #osdev
seds has joined #osdev
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
<netbsduser> heat: mount is nice but unmount, that's where the money is
<heat> i'm doing all of this for umount
<heat> and future weird shit like remounting and mount flags and all that jazz
gioyik has joined #osdev
<immibis> guideX it's ultimately up to you to write whatever they want. there have been systems that only use software to keep programs apart from each other. user mode is a hardware feature for keeping programs apart from each other. you don't *have* to use it... if your design is completely different from most people's. If all your programs are C#, that qualifies as completely different from most people's.
<immibis> user mode isn't something you run into by accident - it's a complicated feature (just like every other feature)
<immibis> Java tried this idea where different programs with different permissions would run together... after 15 years, it gave up because there were just too many permission leaks to plug.
heat has quit [Read error: Connection reset by peer]
gioyik has quit [Ping timeout: 260 seconds]
heat has joined #osdev
<zid> Remember, nobody has ever hacked a games console by using javascript on its web browser
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
gioyik has joined #osdev
<guideX> immibis, ah ok
<clever> zid: wasnt there a multi-year old webkit bug in the ps3 browser? (but the browser itself was in a freebsd jail, so you couldnt escape that)
<immibis> guideX: i'm sure youve already read it, but the idea is that you set some bit (don't remember which bits where exactly) that tells the CPU it's now in user mode, and then all the important instructions, like changing page tables, or interrupt tables, or changing the mode again, will just be 'ignored' by the CPU and instead of doing what they're supposed to do, they activate an exception (which puts the CPU back in kernel mode with an instruction pointer
<immibis> of your choice).
<immibis> it's a hardware sandbox
<guideX> ah ok
gioyik has quit [Ping timeout: 260 seconds]
<clever> guideX: having a properly configured MMU is also critical to doing that security right, for example, configuring it so the kernel isnt writeable by userland
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
flom84 has joined #osdev
<nikolar> heat now that you've mentioned it, I wonder what remounting actually does in the background
<clever> fs/ext2/super.c:static int ext2_remount (struct super_block * sb, int * flags, char * data);
<clever> nikolar: i see a remount function in most fs drivers
<clever> static const struct super_operations ext2_sops = {
<nikolar> so basically delegates to the fs
<clever> .remount_fs = ext2_remount,
<clever> which is then exported to the fs core
<nikolar> yeah so lets the fs handle it
<nikolar> makes sense
gioyik has joined #osdev
<clever> i can see code in ext2, for the ro->rw remount case, where it will re-read the "valid" flag
<clever> i think that flag gets mutated any time something (kernel or fsck) starts changes
<clever> and if the disk was mounted ro, and fsck ran, then the kernel and disk are out of sync
gog has joined #osdev
<nikolar> yeah no i undestand what's going on if it delegates to the fs
<nikolar> i thought it was doing something silly before that
Matt|home has joined #osdev
<clever> it might, would need to search backwards, what calls remount_fs ?
<clever> fs/fs_context.c: return sb->s_op->remount_fs(sb, &fc->sb_flags,
<Matt|home> o\
<clever> fs/super.c: retval = fc->ops->reconfigure(fc);
<clever> nikolar: that is where the kernel does some pre remount checks, like ensuring no files are open rw, when remounting ro
<nikolar> yeah makes sense
gioyik has quit [Ping timeout: 260 seconds]
<nikolar> though i am pretty sure you're allowed to remount even with open files
<clever> i once halted every service with rw handles on my router, and remounted the disk ro
<clever> without causing an outage of its routing functions
<clever> just so i could image the hdd over ssh, without the usual risks of imaging a r/w disk
netbsduser has quit [Ping timeout: 276 seconds]
<nikolar> Heh
<nikolar> Smort
hwpplayer1 has quit [Quit: I'll be back tomorrow and Friday]
<clever> nikolar: oh, and i think .remount_fs is an old api?
<clever> .reconfigure = squashfs_reconfigure,
<clever> static int squashfs_reconfigure(struct fs_context *fc)
<clever> ive found this in other fs's
<nikolar> ah but same idea then
<clever> yeah
<nikolar> delegate to the fs
<clever> that explains why there was a legacy_remount between .configure and .remount_fs
<nikolar> heh
<clever> in the case of squashfs, it forciby sets the read-only flag on reconfigure
<clever> undoing any attempt to remount rw
<nikolar> heh
<nikolar> makes sense
gioyik has joined #osdev
<heat> nikolar, almost nothing
<heat> it just changes some flags if it can
<heat> remount isn't a very interesting operation
<nikolar> well my question was how would the kernel do it, and the answer is it doesn't
<nikolar> it's delegated to the fs
<heat> that's the kernel ;)
<heat> and the kernel does do remounting, for mnt specific flags
<nikolar> you know what i meant lol
<nikolar> interestnig
<heat> basically some flags apply to the struct mount, others apply to the superblock
<nikolar> yea
<heat> you can have a mount that's ro that mounts a superblock that is rw
<clever> you also have abnormal cases like zfs, where the pool may be rw, but the fs is ro
<clever> and there is no real one block device backing a given fs
<nikolar> one would the one backing block device be necessary
<clever> struct super_block {
<clever> struct block_device *s_bdev; /* can go away once we use an accessor for @s_bdev_file */
<clever> i think most FS's hold the backing block dev in here
netbsduser has joined #osdev
<clever> fs/super.c:static void fs_bdev_sync(struct block_device *bdev)
<clever> nikolar: interesting, i think the freeze/thaw functions i see, are used for either suspend2ram, or better disk imaging?
<nikolar> if i'd have to guess based on the name, suspend2ram
<clever> ah, comments mention LVM
<clever> in the ext4 case, its to convince the fs to flush all buffers and make the journal consistent
<clever> before LVM creates a RO snapshot of the disk
<nikolar> ah
<nikolar> snapshotting
<nikolar> interesting
<clever> so the snapshot is in a sane state, rather then an improer shutdown state
<nikolar> yeah got it
<clever> related, i discovered years ago, that XFS cant replay a journal from the wrong endianness
<clever> so if your only BE machine crashes and burns, your remaining LE machines cant perform recovery!
<nikolar> heh
<nikolar> do they not remember what endinanness the journal is
<clever> static int ioctl_fsfreeze(struct file *filp)
<clever> nikolar: its more, that the journal replay code lacks byteswaps
<clever> there is an endianness flag, but the replay only supports native order
<nikolar> that's the more stupid problem
<clever> so if there is a mismatch, it just refuses to mount
gioyik has quit [Ping timeout: 260 seconds]
<clever> ZFS went the fun route, most data structures are created in native order, including the magic number identifying what it is
<nikolar> i know
<clever> if the magic number comes out backwards, then it will byte-swap things on read
<nikolar> yeah, it actually works *cough* xfs
<clever> i also recently had the "fun" of getting doom working on the ppc64 (xbox 360, BE)
<heat> xfs doesn't work?
<clever> in more then a dozen places, they byte swap things they shouldnt (filesize from a syscall, a literal 0), and then dont byte swap things they should!
<nikolar> heat: xfs can't replay the journal from the non-native endianess
<heat> ohno!
<heat> why are you running big endian
<nikolar> clever: people think about endianess too much
<nikolar> heat: do i look like someone who runs xfs in the first place
<clever> heat: i was using a sparc machine as a nas
<heat> it would be too prudent of a choice, you're right
<clever> it had a nice backplane with a lot of sata ports
<clever> then one day it died, and refused to boot
<nikolar> nah, zfs for the win
<nikolar> clever: oh sadge
<clever> yeah, i prefer zfs now
<clever> so, what is ioctl_fsfreeze doing...
<clever> do_vfs_ioctl and FIFREEZE
<bslsk05> ​lwn.net: Freezing filesystems and containers [LWN.net]
<clever> nikolar: aha, perfect, backup stuff, like what i needed on my router a decade ago
<nikolar> heh yea
<clever> just open a mount point like /, and ioctl FIFREEZE, and the kernel will stop all writes, and make the disk clean
<clever> i assume writes will then block until you thaw?
<nikolar> that would be my guess
<nikolar> failing writes would probably be worse
<clever> ah, it also has some auto-thaw timers, so if the backup process hangs, it recovers
<clever> and typical watchdog stuff, where you can keep reseting the timer
<nikolar> interesting
<clever> fsfreeze --freeze|--unfreeze mountpoint
gioyik has joined #osdev
<clever> nikolar: oh, and there is already a CLI tool to access it all!
<nikolar> heh not surprised
<heat> a few hours ago i found out linux lets you mount over / but has really weird semantics
<clever> and yep, it clearly says that things block until you thaw
<nikolar> nice
<nikolar> heat: what
<nikolar> how
<heat> normally
<heat> sudo mount -t tmpfs none /
<heat> try it
<heat> path walking does not seem to dereference it properly
<nikolar> do i want to lol
<heat> if things go to shit just sync and reboot
<heat> at least in my case my path walking was fucky and started hanging weirdly
<nikolar> what did you do
<nikolar> so far seems normal
<heat> try spawning another shell
<nikolar> huh well mpv crashed
gioyik has quit [Ping timeout: 260 seconds]
<nikolar> seems fine
<heat> well idk it hanged here
<nikolar> what are the intended semantics though
<heat> there aren't any
<heat> this case is not covered in the manpage :P
<nikolar> btw after unmounting, mpv works now
<heat> i couldn't unmount
<nikolar> heat: kek why do they allow it though
<clever> oh, i just remembered something nasty that i did by accident one say
<heat> see if its still mounted, cat /proc/mounts
<clever> umount / -o lazy, i think it was?
<nikolar> it is not ž
<nikolar> worked perfetcly fine
<heat> ẑ indeed
<nikolar> *it is not mounted
<nikolar> ж
gildasio has quit [Ping timeout: 260 seconds]
flom84 has quit [Quit: Leaving]
gioyik has joined #osdev
gildasio has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
seds has quit [Remote host closed the connection]
Maja has quit [Remote host closed the connection]
seds has joined #osdev
Maja has joined #osdev
gioyik has joined #osdev
frkazoid333 has quit [Ping timeout: 276 seconds]
gioyik has quit [Ping timeout: 260 seconds]
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
hwpplayer1 has joined #osdev
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
<Ermine> but if you mount over / , don't you lose access to actual rootfs?
<nikolar> i unmounted / and everything was back to normal
<nikolar> so no clue
<Ermine> so those mounts stack somehow?
<nikolar> ¯\_(ツ)_/¯
<heat> mounts stack
<nikolar> does that work in general
<heat> it's perfectly defined to do mount /dir then mount /dir then mount /dir
<nikolar> never tried
<heat> then umount /dir + umount /dir + umount /dir
<Ermine> but why
<heat> this is so defined it's not even funny
<heat> idk, might be useful
<nikolar> does it work as overlay or something
<nikolar> or does the one of the mounts "win
<kof673> ^^^ wasn't this unionfs or similar? i don't recall where, one idea is you might have source on a cd-rom (read-only) then rw obj directory on top... or could just not hardcode paths lol
<nikolar> "win"
<kof673> *don't recall where i saw it described
<heat> nikolar, last one wins
<Ermine> Ah, actually you do that when you mount / in initramfs
<heat> no overlay
<nikolar> huh
<heat> no, initramfs does not mount on /
<heat> there's a funny pivot_root syscall
<nikolar> yeah i know that
<heat> kof673, yeah that's overlayfs or unionfs or aufs or whatever
<heat> different thing where it actually overlays
<kof673> *or ditto for read-only nfs i guess. hmm......
<nikolar> why are there so many overlays fss
<Ermine> you know it's a funky syscall when there's no glibc wrapper for it
<nikolar> there aren't glibc wrappers for a few syscalls
gioyik has joined #osdev
<nikolar> that sound normal enough
<Ermine> btw, is it possible to mount dev1 / ; mount dev2 / ; umount dev1 ?
spareproject has quit [Remote host closed the connection]
<nikolar> heh give it a tr
<nikolar> try
<Ermine> I have no spare linux system atm
<nikolar> what do you run btw
gioyik has quit [Ping timeout: 260 seconds]
<heat> Ermine, i don't think so
<heat> nikolar, the concept of an overlay fs is very tricky and terrible, and you can never do one without exposing really funky semantics
<nikolar> heh
<heat> i don't think the current $overlayfs is POSIX compliant even
<nikolar> kek
hwpplayer1 has quit [Read error: Connection reset by peer]
<heat> an example of trickyness: you have a dir that is being read from the slave fs. you create a file. now you rm -rf the dir.
<heat> boom, 2 terrible edge cases
<Ermine> create a file where
<heat> in the dir
<nikolar> and which one is the slave
<nikolar> the upper layer?
<heat> no, the lower layer
<nikolar> ah right
<nikolar> so the ro one
<heat> yes
<heat> more terrible: modify a file
<heat> Ermine, note: i am in no way shape or form a specialist on linux mounting, they have a bunch of really fancy options like mount propagation and shit
<heat> it's possible that umount dev1 is possible somehow
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
hwpplayer1 has joined #osdev
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
GeDaMo has quit [Quit: 0wt 0f v0w3ls.]
gioyik has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
seds has quit [Remote host closed the connection]
gioyik has joined #osdev
X-Scale has joined #osdev
gioyik has quit [Ping timeout: 260 seconds]
gioyik has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
eddof13 has quit [Quit: eddof13]
\Test_User has quit [Ping timeout: 260 seconds]
eddof13 has joined #osdev
eddof13 has quit [Quit: eddof13]
npc has joined #osdev
hwpplayer1 has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
MiningMarsh has quit [Ping timeout: 252 seconds]
Renfield has joined #osdev
MiningMarsh has joined #osdev
Reinhilde is now known as Ellenor
netbsduser has quit [Ping timeout: 252 seconds]
netbsduser has joined #osdev
Turn_Left has quit [Read error: Connection reset by peer]
eddof13 has joined #osdev
gog has quit [Remote host closed the connection]
eddof13 has quit [Client Quit]
gog has joined #osdev
gioyik has quit [Quit: WeeChat 4.3.5]
\Test_User has joined #osdev
edr has quit [Quit: Leaving]
gioyik has joined #osdev
gioyik has quit [Client Quit]
X-Scale has joined #osdev
netbsduser has quit [Ping timeout: 252 seconds]
gioyik has joined #osdev
eddof13 has joined #osdev
eddof13 has quit [Client Quit]
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
gioyik has quit [Quit: WeeChat 4.3.5]