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
<epony> and why is your SysD port not used on OpenBSD ;-)
<netbsduser`> pam is not needed for systemd-the-service-manager, but i did need it for systemd-logind. i experimented with bsd auth but the way it's integrated with sshd (they use a privilege separation technique) precludes doing essentials like setting environment variables
<netbsduser`> as they run the bsd auth approval scripts in a separate process, so the changed env is not visible elsewhere
<epony> yes most daeons in OpenBSD are privsep / privdrop
<netbsduser`> epony: it was the name i picked for the port
<netbsduser`> openbsd has their own outlook and are not keen on it at all, which is their prerogative
<epony> of course ;-)
<netbsduser`> from netbsd, there is some interest from the gnome port maintainer, and a freebsd guy is also interested in it
gildasio1 has quit [Ping timeout: 255 seconds]
<epony> FreeBSD have the Jordan Hubbard Appliot to proselitise on the wunderbar l'unchd mastery
<epony> but that's not that important.. SysD is not only a Linuxism, but it's also a strict Redhat/Fedhat-ism
<netbsduser`> hubbard launched an initiative some years ago to try to apply some of the tricks he learned at apple to freebsd
<epony> yes
<epony> it's more of a presentation / plead
<epony> some benno took after it as another presentation
<netbsduser`> nextbsd, it was called. i think it fizzled out and he has gone on to health tech or something like that
<epony> no idea, but it's the "apple consumer / user managed requirements" rather than the needs of system operators in the "enterprise"
<epony> so likely the goals are diverging
<epony> the BSDs are neither micro-kernel nor GUI first and tight integration of desktop and consumer control feature sets
<epony> so.. it's much more Linux distrobution as a GUI bundle service level.. and that's what SysD gets you.. with a track to the enterprise too
<epony> I personally don't mind any of that ;-) but it's hilarious
netbsduser` has quit [Remote host closed the connection]
netbsduser` has joined #osdev
<epony> I think OpenBSD did correctly what RedHat had in the pre-systemd years
netbsduser` has quit [Remote host closed the connection]
netbsduser` has joined #osdev
<epony> so wanted to show that as one of the nice points
<netbsduser`> pardon me, i had some net trouble, i've missed anything you said since <epony> I personally don't mind any of that ;-) but it's hilarious
<epony> <epony> I think OpenBSD did correctly what RedHat had in the pre-systemd years <epony> so wanted to show that as one of the nice points
<epony> as an example how shell scripting can be a serious and quite powerful and sustainable tooling
<clever> epony: i once abused a #!/usr/bin/make file as an init.d script
<epony> nice
<clever> so when rc.d ran foo start, it just followed the start: rule
<clever> who needs a switch-case block?
<epony> yeah, I've done that with "one liner" aliases even
<epony> but mostly for functions
<clever> but the entire need for most of that, and mostly the stop action, is gone when using systemd
<clever> just give it an ExecStart that doesnt fork, and systemd handles the rest
<epony> I don't really like and get "chained" command style as useful.. for example the ip tool utils are obnoxious to use
<epony> that's like "begging" for auto-completion scripting to get to use it
<netbsduser`> bsd rc is certainly nicer than sysv rc
<clever> ive found `ip` to be far easier to learn then `ifconfig` + `route`
<zid> openrc for life
<netbsduser`> epony: oh, those are quite mystical to me
<clever> and in the past, ive brought wifi up with just iwconfig + ip, without any display on the laptop
<clever> just type it all in blind!
<netbsduser`> i know ifconfig and have vague notions of solaris dladm
<epony> I just flip the table when having to deal with the ip tools
<netbsduser`> i haven't the foggiest clue about ip
<clever> epony: ip link set eth0 up ; ip addr add 192.168.2.100/24 dev eth0; ip route add 192.168.2.0/24 dev eth0 src 192.168.2.100; ip route add via 192.168.2.1 dev eth0
<clever> done!
<nikolar> That's why network managers exist I guess
<netbsduser`> all i know is that when i tried fedora core last year and i was trying to set up a virtual bridge, i found myself lost in a sea of `ip` and `network-manager`
<epony> for example, when you get used to "mixed" or "out of order" arguments on packet filters and command switches.. it just becomes a huge burden to prefix commands with commands
<epony> clever, well, that's exactly 1 ifconfig and optinal route too
<epony> which is a lot less typing
<clever> epony: i prefer ip, because it makes it much more clear what each thing is doing, and you can then mix&match to make custom things, like: ip route 10.0.0.0/24 via 192.168.2.50 dev eth0
<epony> and.. having that in a "netstart" script that is 2 lines of text that does not repeat.. makes the days go easier and without hiccups
<clever> in the past, ive used that kind of thing to bridge 2 LAN's together over a VPN on a single machine at each end
<epony> you just need to test the setup on an OpenBSD system, you'll like it better
<epony> the only downside is, you need to unset what you set later
<epony> so a decent system operator scripts the unset parts when scripting the set parts
<epony> or creates a reset script that has all the unsets in the typical usage
<clever> that reminds me of a bug nixos has, with iptables
<clever> for security, the stop action on the firewall tends to be omitted
<clever> so the start action atomically replaces all the rules, rather then leaving you firewall-less for a few seconds
<epony> so, I have exactly what networkmanager gets you to achieve, with 2 plain text files which are.. shell scripts and run every single time reliably
<clever> but, during certain upgrade situations, it switches from iptables to xtables i think
<clever> and it doesnt remove the old set of rules
foudfou has quit [Ping timeout: 255 seconds]
<clever> so, all your packets wind up going thru the old rules, then the new rules
<clever> if the rules dont change, youll never notice
<epony> the main premise for this is: the system tools are 'stable' and when they "change" the change is cosmetic / minor or well understood and contiguous brain regions
<clever> but when you do go to change the rules, the old system isnt updated anymore, and now you start tearing your hair out
<clever> because iptables is set to allow, yet its blocking
<epony> while the jump from ifconfig/route to ip tools is mind fluidity breaking
<epony> and with the years these things add up..
<clever> the xtables stuff, has some iptables compatabily cli tooling
<epony> many machines, many systems, many changes, many frameworks..
<clever> so to the average user, you wont even notice the change
<epony> yeah I recall that from the days of ipfw / ipchains
<clever> which just leads to even more hair tearing, because it looks basically identical to the old iptables framework
<clever> and your not aware that youve got 2 sets of tables filtering things
<epony> the average user becomes an expert after 20 years of scarification ;-)
<epony> I do really like tool improvement
<clever> i remember when you had to write an xorg.conf for it to work at all
<clever> but now it can auto-gen it on the fly
<epony> and think there is value in the ip tools as they are similar mindset to the packet filter rule set
foudfou has joined #osdev
<epony> yeah, X was supposed to auto-generate it back in the mid-90ies too
<epony> just getting that "switch too late to appreciate the comparison desync as operator context switching and conversion periods" is not that nice
<clever> i also had some rather fun problems with X on the rpi a year-ish ago
<clever> xterm was transparent, xeyes had eyes ontop of transparent
<epony> I have xcompmgr "on demand"
<clever> this was without even a window manager running
<epony> not using (x)eyes ;-)
<clever> it was transparent to the point that it was showing the hw compositor bg fill color
<epony> nice, I like fallback sessions
<clever> the bug, is that i had told the hardware to respect the 8bit alpha in every pixel
<epony> with I use a WM otherwise what good are the graphics when it's non-interactive
<clever> and xorg just blindly passes 32bit colors from each app to the /dev/fb0
<clever> xterm happened to set the alpha channel to 0
<clever> xeyes filled the window with 0 alpha, but drew the dots on the eyes with 0xff alpha
<epony> compositors were supposed to be "nice" ;-)
<clever> i keep a basic compositor enabled at all times on my main desktop
<epony> you probably are in the wayland early adopters guild
<clever> i have yet to try wayland
<epony> I don't, it eats 2-5% of my machine
<clever> main problem i hear, is a lack of fullscreen capture
<epony> and am running on a 2W machine at the moment
<epony> so can't afford dumb things
<epony> but I don't use it on my 110W machine either
<epony> these thngs are "optional" / user preferences, not that dramatic
<nikolar> One thing I really dislike about wayland is that it's very Linux oriented
<clever> epony: https://i.imgur.com/fGPf9dr.png is what happens when xeyes is bleeding transparent pixels
<epony> but the "hay where did the classing networking setup tools go?" and "what happened to my scripts" and "where are now the units to configure what locked up" and.. "why so much change all the time every 2-3 years breaking and competing dramatic turnovers" ;-) is overhead
<clever> epony: https://i.imgur.com/NzfhmPV.png xclock also did the same thing (the rgb subpixel image is all transparent areas)
<epony> yeah, Linux first remains Linux-only and "Linuxism" most of the times
<clever> https://i.imgur.com/xxquKD9.png is what you then get, if you ignore the alpha channel
<clever> there was an xterm window under xclock, that you couldnt even see
<epony> I like Linux, but it's not everything, and applications that begin to depend on the Linux-only parts that are not portable.. are thus lost
<nikolar> Or worse, they diminish the usefulness of other unices
<epony> clever, I use a scripted sessions initialisation for my machines on the xinit / xsession
<clever> epony: in this case, i was just testing the graphics outputs, to work out the bugs, before i just threw full xfce at it
<epony> which has various components and pre-configured attangements, window parameters and workloads for them
<heat> other unices are already useless
<heat> I also do not see anything in wayland that makes it linux oriented
<clever> epony: once i fixed the bugs, https://i.imgur.com/b8lrmUx.jpg came out of the system
<heat> they use standard POSIX facilities
<epony> I haven't used a desktop for a long time, because at the point they started adding JS and CSS and KDE became sluggish and plasmodic.. I just went desktoyless
<epony> so XFCE can not win back what is forever gone
<epony> the "trust in the desktop" evaporated
<epony> went scripting and managed sessions completely
<epony> I like the desktop convenience on fast and powerful computers.. but it's too much on legacy HW
nyah has quit [Quit: leaving]
<epony> it's for a reason that I escaped out of the MSFT captive system interfaces, they were not programmable and reliable / sustainable
selve has quit [Remote host closed the connection]
<epony> early cde, xfce, kde up to 3.5-4, gnome.. up to 2.x were nice and heavy but usable
selve has joined #osdev
<epony> motif looked a bit wasteful on "screen area"
<epony> the athena toolkits were clumsy
<epony> twm and later being "absurdly primitive" are actually quite useful
<epony> fvwm and similar, on OpenBSD there is one stacking "cwm" and another previous tiling "scrotwm" (note the theme in the naming, hehehe)
<epony> are quite lean and useful
<epony> even dwm and the suckless things are not very intriguing as their "minimalism" is not "usability" and "stability" long term
<epony> guess I like compositors too for I like smooth and accelerated redraws etc
<epony> but I don't / can't be bothered with the "chasing the mobile look and feel" (while this works better), when that works without wasting screen space, I'll think about it 5 minutes
gog has quit [Ping timeout: 248 seconds]
<epony> GUI aplpications are nice, but.. the mobile theming is absurd on laptops and desktops
heat has quit [Remote host closed the connection]
Burgundy has quit [Ping timeout: 268 seconds]
heat has joined #osdev
<epony> I'd script the next stage to roaming applications between systems and same for virtual machines.. someday
<epony> when that is "complemented" with a movable homedir (machine locality independence) the cloud is "here" and achieved better with complete control
<epony> so a couple of proxy re-attach and multplexing is the better approach, if the compositor and new display server protocol gets that goal set closer, I'll be using it fine
<epony> about sysd I just don't have usage, and the ip tools are not such a big bore / but I am not replacing it pro-actively.. when the system gets improvements I'll take these
<epony> the only really uncool part is the "reliability" and "quality" of the applications ;-) as you all too well know too
CryptoDavid has quit [Quit: Connection closed for inactivity]
<epony> It would be a lot more interesting to see different efficiency and reliability switchable kernel modes at runtime (and programable adaptive variants) without losing processes and application state from system to system..
sebonirc has quit [Remote host closed the connection]
sebonirc has joined #osdev
<epony> so, that's what I want, programs and data sets that are in proximity and moving with the person on demand and remaning in syncronsed or coherent "re-join" reconcilleable state
heat has quit [Read error: Connection reset by peer]
<epony> ..and world peace ;-)
heat has joined #osdev
<zid> PC LOAD CAKE
<heat> I'm using C++20 ranges for a specific thing in my new test-runner
<heat> shoot me if I start saying that std::accumulate is a good function
<heat> actually, I'm not, yay
<mjg> int3rw3bz
<kof123> little c89 little c89 let me in / not by the >= 8 bits char on my chinny chin chin
<bslsk05> ​'Green Jelly - Three Little Pigs (Official Video)' by GreenJellyVEVO (00:05:55)
slidercrank has quit [Ping timeout: 264 seconds]
<zid> did you pc load cake though
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
<zid> did you pc load cake though
<heat> no
<heat> no
<klys> is that cake viral
<zid> No bacterial
<zid> yeast infact
<zid> actually yeast is a fungus nevermind
<klys> I like the printout on the frosting
<klys> and imagine it could represent stuxnet
<zid> what on earth klys
<klys> of course I don't read russian
<zid> it's the printer test page
<klys> :)
<zid> they put the cake in their printer to print off HAPPY BIRTHDAY and a face of a 5 year old or whatever, but the printer decided to use that moment to do a test cycle
<zid> so now their cake has a test print on it
<klys> smart kid
<zid> are you like, high as fuck
<klys> it must be all the endorphins, I was just talking with a bunch of old ladies for a while
fel has quit [Remote host closed the connection]
fel has joined #osdev
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
fedorafan has quit [Quit: Textual IRC Client: www.textualapp.com]
terrorjack has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
<heat> I did all this work to avoid parsing text for CI as much as I could
<heat> guess what? parsing text is unavoidable ahhhhhhhhhhhhhhhhhhh
<sham1> You can't avoid it
fel has quit [Remote host closed the connection]
fel has joined #osdev
heat_ has joined #osdev
heat has quit [Ping timeout: 248 seconds]
heat_ is now known as heat
srjek has quit [Ping timeout: 248 seconds]
<Ermine> heat: afaik you don't need struct keyword here: https://github.com/heatd/Onyx/blob/master/kernel/drivers/ahci/ahci.cpp#L893
<bslsk05> ​github.com: Onyx/ahci.cpp at master · heatd/Onyx · GitHub
<heat> i do not
<heat> 1) ahci.cpp was ported from C 2) I usually call page struct page per Linux tradition
<Ermine> okay
<heat> the same applies for e.g struct ahci_device on the same file, but that really is just leftovers from C
<Ermine> yeah, seen that too
mehdix has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
wand_ has quit [Remote host closed the connection]
Matt|home has joined #osdev
wand has joined #osdev
<sham1> You need to DRY off your code
xenos1984 has joined #osdev
sashka has joined #osdev
<heat> sham1, yes. all my ata code needs some care
<heat> the first step would be to probably unify all ATA on a separate layer from AHCI and IDE, and have AHCI + IDE as purely buses
<Ermine> libata?
<heat> yeah something like it
<epony> cripple-A gaming awaits your work to make it possible
<epony> well, if it can't be HD video in the browser, at least some notepad replacement in.. a text framebuffer
<epony> lets compromise on headless with a networkng and a serial console, we'll see about usb when the adventists of the late day come
<epony> one chipset only is fine too, at lest the keyboard will work
<epony> at least it fits in the first sector
<epony> ok.. we'll think about the jtag later, let's see if it can find the list of devices for now..
<epony> oh.. I had that model too
fedorafan has joined #osdev
<geist> hmm, atari 1040st for sale nearby
<geist> i always kinda wanted one, but.... probably not this much
<geist> ah eh, less interested. an atari Falcon would be really great
<geist> but i think those are super rare
<heat> the combination of LTO + ASAN bloated up my kernel into finding a slight bug in the early boot mappings
<heat> also: GCC LTO scares me a lot
<geist> word.
<bslsk05> ​github.com: Onyx/vdso.cpp at master · heatd/Onyx · GitHub
<heat> innocent enough. creates a vmo, fills it with pages, parses some stuff from the vdso image, and sets up the time accel stuff
<heat> meanwhile, GCC LTO: 2.3% 101KiB vdso::init()
<heat> ??????? what exactly did it inline???????? half the fucking kernel?????
<heat> i must apologize. bloaty seems to be broken here
<heat> gcc, you are not that stupid. although you still really want to inline half the rx packet code path in ethernet::rx_packet
<kof123> hmm, cmi/knit (parts of oskit) "cross module inliner" "flattener" had a ...too lazy to look up the name...."target" value (integer, positive or negative) how aggressive to be.
<kof123> surely there are flags
<kof123> (not blaming the user)
<heat> pebkac for sure ;)
heat has quit [Ping timeout: 248 seconds]
sashka has quit [Ping timeout: 268 seconds]
<sham1> 80% of the time in some manner
dennis95 has quit [Ping timeout: 246 seconds]
friedy has quit [Ping timeout: 246 seconds]
fel has quit [Ping timeout: 248 seconds]
dennis95 has joined #osdev
fel has joined #osdev
danilogondolfo has joined #osdev
mehdix has joined #osdev
gorgonical has quit [Remote host closed the connection]
unimplemented has joined #osdev
unimplemented has quit [Read error: Connection reset by peer]
<aws> in a kernel, can you give a concrete example of something that needs the physical memory allocator to be able to allocate physically contiguous blocks of memory?
bgs has joined #osdev
<Mutabah> aws: DMA for older hardware
<Mutabah> (most modern hardware supports scatter-gather DMA, but older hardware needs physically contigious buffers)
<Mutabah> The easiest solution for that is to soft-reserve the first 16-24MB for hardware allocations and use a bitmap for it
<Mutabah> (I.e. don't do general purpose allocations from that region until you have no other choice)
<Mutabah> (24MB is the limit for ISA DMA, hence that's the cutoff I use)
<aws> OK, thanks. So, assuming I do not need to deal with such hardware or if I deal with them like you said with a 16-24MB region; for the rest of the memory a simple physical memory allocator design using, for example, a linked list for freed blocks is enough, right?
Burgundy has joined #osdev
<ddevault> recording of my FOSDEM talk on helios: https://spacepub.space/w/wpKXfhqqr7FajEAf4B2Vc2
<bslsk05> ​'FOSDEM 2023: Introducing the Helios microkernel' by Drew DeVault (PT2679S)
<ddevault> it went well :)
<aws> i physically went to the first shorter one saturday, and to the hare community talk/meetup :)
<ddevault> :D
<ddevault> how was your FOSDEM experience
<aws> it was really great! it's the first time i went, it was very refreshing to be among people interested in the same kinds of things i do, and attending inspiring talks
gog has joined #osdev
GeDaMo has joined #osdev
nyah has joined #osdev
bauen1 has quit [Ping timeout: 255 seconds]
gxt has quit [Ping timeout: 255 seconds]
fedorafan has quit [Ping timeout: 248 seconds]
slidercrank has joined #osdev
fedorafan has joined #osdev
fedorafan has quit [Ping timeout: 248 seconds]
fedorafan has joined #osdev
Burgundy has quit [Ping timeout: 255 seconds]
randm has quit [Remote host closed the connection]
randm has joined #osdev
<mrvn> aws: even with such hardware a simple linked list is enough
<mrvn> At boot it's easy to find a contiguous chunk of memory in the linked list, it will be 99% sorted.
bauen1 has joined #osdev
<mrvn> And if you need to allocate contigious buffers later then you need some way to defrag physical memory. reserving some memory won't help in the long run, it will get used up eventually and then you need a defrag anyway. So why bother with reserving?
<Mutabah> mrvn: well, the assumption is those drivers allocate really early in boot
<aws> yeah, if i take those contiguous blocks out of the memory that has never yet been allocated/deallocated, but these contiguous block decrease in availability as time goes on i would imagine
<mrvn> exactly. Just take the last N pages from the list and you get contigious memory.
<mrvn> There is also hardware that only does 32bit DMA where you have to allocate the buffer in the first 4GB of memory. Similar problem. Best to allocate buffers for them at boot and keep reusing them over and over.
<mrvn> Alternatively run them with 4k buffers even if smaller buffers are a bit slower or buy new hardware.
<aws> well anyways, it looks like link list of free blocks is a simple and reasonable solution then, at least for the time being
<mrvn> If you use virtual memory for everything (except maybe page tables) then writing a defragmenter is real easy as well. You just need a way to stop all other cores and then copy the data to other pages to get a contigious chunk. If it's only needed when someone runs "insmode stupid_driver.ko" then that is just fine.
CryptoDavid has joined #osdev
<mrvn> aws: if you don't keep all pages always mapped somewhere then a list of stacks is preferable. struct free_pages { phys_addr page[510]; phys_addr next; };
<mrvn> 511 even
<aws> thanks for the tips, running a defragmenter to make a block of contiguous data occasionally doesn't sound too bad
<mrvn> aws: with occasionally meaning once a year or less.
<mrvn> aws: and that is if you even support rmmod/insmod.
<mrvn> For the 32bit DMA case keep 2 lists of free pages. <4G and >4G and prefer the >4G page unless it's for 32bit DMA. Other than that just hope for the best.
<mrvn> I really wouldn't worry about both cases at all unless you actually own some hardware with that problem.
<netbsduser`> i have an aversion to allocating physically contiguous pages
<netbsduser`> i will probably figure out how to program the IOMMU before supporting it in my kernel
<netbsduser`> so far it hasn't been a necessity for me (virtio-nic and virtio-disk do scatter-gather, and NVMe too)
gxt has joined #osdev
<mrvn> does IOMMU work with old ISA DMA?
joe9 has joined #osdev
<Mutabah> mrvn: don't think so?
<Mutabah> (never implemented IOMMU, so don't know for sure if it could)
gildasio1 has joined #osdev
<dinkelhacker> Is it possible to tell qemu that it shall generate an alias node in the dtb for certain things?
<dinkelhacker> Oh well nvm.. I think that was a silly question. Was wondering how to find out from the dtb which uart one shall use as default. Looks like there is a stdout-path property in the chosen node to specify that.
epony has quit [Remote host closed the connection]
heat has joined #osdev
<heat> aws, fun question. if you want to do memory management like linux (where getting contiguous memory is VERY important for slab purposes), you always need contiguous memory and you might as well get a buddy allocator for it
epony has joined #osdev
<heat> it is the faster memory allocation method, since you don't need to map pages, you can just use the direct map of physical memory as is
<aws> The argument of the mapping pages overhead and instead directly using the physical memory map is interesting, thanks
<heat> no problem. there's very large overhead in mapping/unmapping in the kernel due to TLB maintenance issues
<heat> A single unmap/mprotect of a kernel address needs to broadcast a TLB shootdown
<heat> unless you take steps to avoid that, which linux does on vmalloc, but it's still not really enough
srjek has joined #osdev
[itchyjunk] has joined #osdev
CryptoDavid has quit [Quit: Connection closed for inactivity]
x8dcc has joined #osdev
xenos1984 has quit [Quit: Leaving.]
fedorafan has quit [Ping timeout: 252 seconds]
<mrvn> dinkelhacker: the DT has an alias for the console on some hardware but not always.
<mrvn> dinkelhacker: sometimes you might just have to assume it's the first uart or output to all or something
<mrvn> heat: Placing anything in the mapped physical memory risk corruption on over/underflow. And why would SLAB need contigious memory?
fedorafan has joined #osdev
<mrvn> As for shootdowns that's a security feature. You don't have to shoot down kernel memory unless you want to catch access after free (or reuse of the address).
<heat> mrvn, your whole physical memory is mapped anyway, might as well make use of it
<heat> and with this layout slab does indeed need contiguous memory allocation
<mrvn> You need a shootdown every time the kernel address space rolls over but with 64bit that's rare.
<mrvn> heat: mine isn't.
<heat> and no, shootdowns are not a security feature
<heat> good for you!
<mrvn> Hard to do on 32bit.
<heat> false
<heat> it's how it's always been done in many many kernels
<heat> even in 32-bit
<mrvn> how do you map 4GB of ram and then run kernel in virtual address space?
<heat> you don't
<mrvn> see
<mrvn> I think linux is limited to mapping <1G.
friedy10 has joined #osdev
gildasio1 has quit [Ping timeout: 255 seconds]
gildasio1 has joined #osdev
[_] has joined #osdev
<mrvn> heat: as a side node: mapping all memory greatly looses benefits in a microkernel because all the drivers are processes with their own page table and no access to the mapped physical memory. Makes it far less annoying that you can't do it in 32bit (with modern 2/4GB ram) anway.
[itchyjunk] has quit [Ping timeout: 255 seconds]
<heat> drivers don't access the big mapping
<nikolar> what would be the simplest gpu to write a driver for
<nikolar> that's not just a framebuffer
<mrvn> .oO(What is the simplest gpu that isn't the simplest gpu?)
<nikolar> pretty much :)
<mrvn> Are going to buy one or why do you ask?
<nikolar> well i want to try writing a gpu driver at some point, but i don't really feel like going through hundreds of pages of intel hd graphics manual
<heat> nikolar, do you want a real GPU or a fake GPU?
<mrvn> So you want to know what the simplest graphics driver in qemu is to write a driver for?
<nikolar> fake is ok
<mrvn> Something with a bit of hardware accel.
<zid> bochsvbe
<nikolar> mrvn: yes
<zid> is just write magic to mmio reg, write width/height to mmio reg
<zid> done
<heat> nikolar, virtio-gpu
<heat> bochs vbe is not a GPU, it's a shitty VGA thing
<zid> same thing :P
<heat> qxl is OK but largely undocumented and I think superseeded by virtio-gpu
<heat> the vmware gpu is also superseeded by virtio
<nikolar> so virtio it is basically
<heat> yes, the 2D accel bits plus modesetting are all defined in the virtio spec
<nikolar> cool thanks
<nikolar> what about real gpus, are you aware of any that aren't ridiculous to work with
<zid> voodoo 2
[_] is now known as [itchyjunk]
<mrvn> nikolar: nothing one would call GPU is trivial. They are all about composition and shaders and 3D.
<heat> nikolar, btw the opengl/vulkan bits are not explicitly documented I think so https://gitlab.freedesktop.org/virgl/virglrenderer/ and have fun
<bslsk05> ​gitlab.freedesktop.org: virgl / virglrenderer · GitLab
<nikolar> i am aware that they aren't trivial
<nikolar> thanks
<heat> ok so, not ridiculous to work with: intel
<heat> you could also port DRM like most people (BSDs, Haiku too?) do
<nikolar> fair
xenos1984 has joined #osdev
<sortie> heat, jeez you're all GNU and now you're advocating for DRM
<mrvn> nikolar: if you do virtio then everyone can use your kernel with kvm on their hardware. Any other driver will be for a limited user base.
<nikolar> That's a good point
<mrvn> sortie: direct rendering manager vs. digital rights management?
Burgundy has joined #osdev
<sortie> direct rights management
* sortie . o (direct2dvd rights management)
foudfou has quit [Quit: Bye]
foudfou has joined #osdev
<heat> sortie, this is a classic the pig and the box moment
<sortie> Can I have vegan DRM?
<heat> nikolar, that's also a wrong point. only emulators/hypervisors that support virtio-gpu can use virtio-gpu, same for any other emulated gpu and/or hardware
<heat> although actual hardware drivers are IMO way more exhilarating
<nikolar> i definitely agree with that
<nikolar> but makes more sense to start with something simplere
<nikolar> simpler
<heat> sortie, the story is very vegan. unless there's a new chapter where big corp gets tired of the pig and roasts him for a nice dinner
<heat> which would be *hilarious*
<sortie> pig in the box
fedorafan has quit [Ping timeout: 248 seconds]
<heat> sortie, GNU sucks and so does BSD - use Windows
<heat> thank you!
<nikolar> windows - the clearly superiour environment
<heat> absofuckinglutely
<heat> using anything unix is signing yourself up to struggle to use computers
<nikolar> as if windows isn't struggle :)
<heat> it is not
<heat> sorry :(
<nikolar> oh no
* sortie gives heat a backslash
fedorafan has joined #osdev
<heat> \Device\{8912c5bb-5bfc-468d-8d19-fe5895b95366}\Null
<nikolar> beautiful
<sham1> \
<sham1> \\
<heat> \\\
<sham1> mfw the client actually escapes backslashes
<sortie> \\sham1\
<nikolar> copy /r *.*
<kof123> there used to be a joke in a another channel that the way to keep people's attention was "xyz lang had a child...guess who the father is?" i.e. turn it into jerry springer. i feel this is needed to keep track of ms loves linux
<nikolar> copy /r *.* D:\
<sortie> net send sham1 sup
<heat> @echo off
<sham1> Oh great, it's the Windows equivalent of wall
<nikolar> goto start
<sham1> Except networked
<sham1> On Error Goto Next
<sham1> Err, Resume Next
<sortie> net send sham1 "You have virus Send money to +1 800 SORTIE"
<nikolar> cls
<sortie> dir
<sortie> copy cons heat
<sortie> @echo on
<sortie> ^Z
<sortie>
<sortie> type heat
<heat> net send * "Single Moms In Your WorkGroup Want To Fuck"
<mrvn> that's what she said
<Amorphia> lmfao
<sham1> Oh great, the workgroup has been infiltrate by pop-up ads.
<sham1> infiltrated*
<kof123> well, there was always winnuke
xenos1984 has quit [Ping timeout: 248 seconds]
xenos1984 has joined #osdev
<zid> This is albanian virus, please send to two other friends I am not good with computer.
Burgundy has left #osdev [#osdev]
gog has quit [Quit: Konversation terminated!]
<heat> I got CI tests running in github actions yesterday
<heat> it was painful but it's done I guess, all in fucking TCG
<heat> I think you can pay for nested KVM github actions but screw that
<zid> have you considered just not testing anything
<zid> it's way easier
<geist> oh yay
<x8dcc> hello everyone
<x8dcc> heat: I have been messing with what you told me yesterday, and now I am going to try to map the sections. What virtual address do you recommend?
<x8dcc> for .text, .data, .rodata, etc.
Bonstra has quit [Quit: Pouf c'est tout !]
<heat> x8dcc, do identity mappings for now
<heat> 1:1 (0x100000 -> 0x100000, etc)
<x8dcc> hmm, okay. Thanks
Bonstra has joined #osdev
<zid> If they don't match your code either needs to support being ran from any address, or you compile it to be ran from the virtual address and hand-write the mmu setup in assembly that way before jumping to the real code
gog has joined #osdev
<zid> no-op page tables much easier to set up
<x8dcc> support being ran from any address? are you talking about something specifically?
<zid> it's called position independant code
<zid> so it can't do things like calling certain addresses
<zid> loading data from certain addresses, etc
<x8dcc> why?
<zid> okay so imagine you have like 0x10000: _start: blah 0x10001: blah 0x10002: nop ...
<x8dcc> yeah
<zid> and I enable the mmu
<zid> and instead map 0xC00000 to 0x10000, and 0x10000 to nothing
<zid> eip now points to.. nothing
<zid> next instruction crashes, whoops
<x8dcc> oh I see
<zid> so you think to yourself aha!
<zid> I will make both mappings!
<sham1> A kernel with fPIE would be interesting to set up. Relocations don't seem all that bad now that I've read up on it
<zid> I'll map 0xC00000 to 0x10000 and 0x10000 to 0x10000 as well
<zid> so now we can enable the MMU and EIP won't point to garbage, and then we can jump to 0xC00010 or whatever to continue from there
<zid> but now start goes 0x10000: blah, 0x10001: nop, 0x10002: enable mmu, 0x100003: jmp highaddr; 0xC000004: nop
<zid> but now I have a bunch of weirdness about where everything *else* lives, how do I tell the compiler that 'printf' is now at 0xC002000 and not 0x102000?
<zid> patch all my call instructions?
<x8dcc> I see now
<zid> The solution is just.. don't use absolute addresses in the first place for anything
<x8dcc> painfully interesting
<zid> or split the binary in half so that the first bit doesn't need anything from 0xC0xxxx (because it won't be there) and enables the MMU
<zid> and 'everything else' just expects to be at 0xC000xxxx
<sham1> The split approach will be slightly convoluted
<sham1> I'd say that even for a 32-bit kernel it'd be easier to have a separate loader that kicks you up into the higher half, setting up paging. It means that you wouldn't need weird linker tricks
<zid> Yea it can get hairy without some good linker magic spells, or just writing a bunch of code in assembly
<zid> I use just two full binaries cus that's way fucking easier to link :P
<zid> boot.bin and kernel.bin, boot.bin is written in C and loads kernel.bin, then enables paging and one instruction later jumps to kernel.bin
<zid> (okay not quite one instruction later I set up a stack pointer for it too)
<sham1> Yeah. It's especially good on 64 bit kernels because then one can set up everything in peace
<zid> https://github.com/zid/bootstrap/blob/master/boot/long.asm last thing main() in boot.bin does is call this assembly snippet that enables paging (just loads [esp+4] into cr3) and jumps to 0xffff8000000
<bslsk05> ​github.com: bootstrap/long.asm at master · zid/bootstrap · GitHub
<zid> main is all C running in segmented pmode
<zid> kernel.bin never has to deal with paging ever being off, or protected mode
<x8dcc> zid: thanks for the link
<zid> idk how easy it is to make whatever's booting you deal with two different binaries though, might be easier for you to just roll them into one
<zid> because you get the benefit of always being elf_i386
<x8dcc> right now I am only using one. I wanted to add more than 1 and I saw some people load them as modules, but I haven't really looked into that
<zid> sounds like grub, that's what I do
<bslsk05> ​github.com: bootstrap/grub.conf at master · zid/bootstrap · GitHub
<x8dcc> yeah, pretty sure one of the examples I saw was yours :^)
<zid> yea but this is all a distraction over what you were supposed to be doign
<mrvn> sham1: nothing weird about setting an LMA in linker scripts
<mrvn> sham1: How do you start the other cores when you have separate loader and kernel on x86?
<sham1> Well your AP core setup would be distinct code anyhow to get to long mode
<mrvn> so you duplicate all the code the loader has?
<sham1> Well the parts that deal with setting up 64-bit long mode, yeah. The loader would still have a completely different half to deal with loading your kernel ELF alongside dealing with multiboot or whatever boot protocol one has, including a custom one
<mrvn> sham1: would be better I think if the loader would bring up all cores and call a function in the kernel in long mode
<sham1> Eh, that works too
<sham1> Indeed that, setting up a clock source and loading the initial userland servers would be my strategy in a microkernel scenario, although even for a monolith it sounds good to at least partially parse the ACPI and other related structures
nytpu has joined #osdev
nur has joined #osdev
<x8dcc> well I think it's booting, but I can't use my framebuffer console yet because heap allocation is broken lol
Brnocrist has quit [Ping timeout: 260 seconds]
<x8dcc> I am going to try the rodata thing with the vga console for now
srjek has quit [Ping timeout: 248 seconds]
gildasio1 has quit [Quit: WeeChat 3.8]
<gog> booploading
<zid> |b|ootloadig
<zid> gog help me with https://squaredle.app/
<bslsk05> ​squaredle.app: Squaredle | Daily Word Search Puzzle
<zid> I have 11 words left
<gog> didyou get epilogue
<zid> I did
<zid> missing two six letter words, a 5, and 6 fours
<zid> three of the latter start with p
<zid> apparently I don't know any words that start with p
Brnocrist has joined #osdev
<gog> plot
<zid> aha, got a 6 and a four, cognates
<gog> plug
<zid> p*** p*** o*** n*** m*** o**** mo**** left
<zid> ..I missed plug :D
<zid> that removed u and g too, winner
<zid> molten!
<Ermine> hot or cold?
<zid> 3 left..
<zid> done phew
xenos1984 has quit [Ping timeout: 248 seconds]
<GeDaMo> Did you get glom?
fedorafan has quit [Ping timeout: 248 seconds]
gildasio has joined #osdev
fedorafan has joined #osdev
<zid> glit glom glome glop lipic lome lune meno metic mone moult nome otic pilon plie polt pome pone pote
<zid> were the boners words
xenos1984 has joined #osdev
k0valski18891 has joined #osdev
brocellous has joined #osdev
<x8dcc> this is what I thought for fixing what heat told me, but it is not working and it's probably something dumb. https://dpaste.com/C556N9LDW#line-71
<bslsk05> ​dpaste.com <no title>
<zid> okay define not working
<x8dcc> well actually I don't know what it's supposed to happen, but I expected a cpu interrupt or something
<zid> when you do what?
<x8dcc> write to a string literal in the rodata section
<zid> nothing here actually touches memory, or paging structures etc that are in use, you're just making an array
<zid> and calling some made up functions
<x8dcc> well those functions load the page directory and enable paging, I can send them too
<zid> I mean, it's just kind of impossible to tell you what the "problem" is, when you don't seem to have a problem? :P
<x8dcc> but what should cause an exception (afaik) is calling the function heat sent, which writes to a string literal
<x8dcc> zid: if you do something like " char* p = "test"; *p = 'b'; ", whats supposed to happen?
<x8dcc> should the cpu or the mmu raise an exception?
<zid> try `info tlb` in qemu btw
<x8dcc> oh, didn't know about that. Thanks
<x8dcc> is there any way I can... scroll?
<zid> oh you have your monitor set up stupidly then
<zid> -monitor stdio
<zid> and just scroll your terminal
<x8dcc> haha okay
<x8dcc> yeah, W is disabled for the rodata entry
<zid> show the output
<x8dcc> I didn't set those other flags btw
<zid> That doesn't look like what your code tried to do?
<x8dcc> wdym?
<zid> what do you mean what do I mean
<zid> does the output match what you expected it to be
<x8dcc> well in 0x105000 W is disabled, so yeah
<zid> and you started mapping at 0xf3?
<zid> oh it's probably cut off at the top
<x8dcc> I don't know about those A and D flags, not sure why they are there
<x8dcc> zid: yes, it is
<zid> D is dirty, means the cpu accessed it
<zid> and changed it
<zid> A is accessed, means it was read from
<x8dcc> yeah, I read about all those flags but I forgot lol. ty
<zid> what's the address of your string?
<x8dcc> 0x1108DA... why? its literally the 2 lines I sent
<zid> what is
<x8dcc> shouldn't it be in .rodata?
jimbzy has joined #osdev
<x8dcc> char* p = "test"; *p = 'b';
<zid> now tell me the mapping on the page 0x1108DA is on, and you should have your answer
<zid> (dirty, accessed, writeable, so hey, at least your write happened)
<x8dcc> yeah
<x8dcc> but why is the string there? :(
<zid> readelf?
<zid> also tiny arrays like that may get optimized to just being on the stack or whatever
<zid> especially if the optimizer sees it isn't used
<x8dcc> oh
<zid> You probably wanna make it required behavior a global function that it can't delete
<zid> if you wanna void the optimizer messing with you
<x8dcc> what are those?
<zid> bits of rodata
<zid> you might have -fdata-sections or something on in your compiler
<zid> my linker script globs that crap into just raw .rodata
<x8dcc> well I think that is the issue here
<x8dcc> should I try to disable -fdata-sections or...?
<zid> it isn't
<zid> nm the binary
<zid> check what you actually get on your rodata symbols
<zid> oh wait hmm
<zid> yea I see it now, it'll be too short
<zid> you need .rodata : { * (.rodata*); } somewhere in a linker script, or to not generate .rodata.blah yea
<zid> -fno-data-sections may exist idk
<x8dcc> hmmm okay, I am going to try that now. Thanks :)
<x8dcc> now the string is in 0x10FD8A, but those .rodata.* sections are gone from readelf
<x8dcc> the string is not in .rodata, but it's probably just optimized
<zid> now nm it and see what your _rodata_start etc things are
bradd has joined #osdev
<x8dcc> 0x10528A, same address printed when ran
<x8dcc> didn't know about the nm command by the way
<zid> might wanna just.. look at the tools in binutils at some point
Burgundy has joined #osdev
dutch has quit [Quit: WeeChat 3.8]
fedorafan has quit [Ping timeout: 248 seconds]
heat has quit [Remote host closed the connection]
heat has joined #osdev
<mrvn> x8dcc: strings are const. char* p = "test"; should give you a compiler warning
Gooberpatrol66 has joined #osdev
<mrvn> x8dcc: you want a char array
<x8dcc> I want that to get an error
<x8dcc> I want to try to write to .rodata
x8dcc has quit [Quit: Lost terminal]
<mrvn> the first check *p is in .rodata and secondly check the disassembly if the code will write to it
x8dcc has joined #osdev
<x8dcc> well p is now in rodata
<mrvn> x8dcc: don't forget to page align your sections
<x8dcc> I have them aligned
jafarlihi has joined #osdev
<jafarlihi> Henlo
<jafarlihi> I've got a question
<jafarlihi> With all the exploit mitigations, things like ASLR, are memory corruption bugs even exploitable anymore?
<mrvn> and also try: extern char _start[]; *_start = 0;
<mrvn> jafarlihi: totaly.
<mjg> lol
<jafarlihi> mrvn: But how do you defeat so many mitigations?
<mjg> google for aslr bypass
<\Test_User> wait for a few pointers to be given out in some form, then exploit based on that?
<jafarlihi> mjg: I mean, ASLR is just one though
<mjg> whatever migitation you have in mind, google for bypass
<\Test_User> doesn't work for everything ofc, but some things do give that out
<mjg> for example see rop and brop
<mrvn> jafarlihi: aslr only works per library so if you get knowledge about any address inside the targeted binary or library then you can access anything from the binary or lib.
<jafarlihi> But, then you need two vulnerabilities, the original memory corruption + the bypass weakness?
<x8dcc> mrvn: I checked the tlb using 'info tlb' as zid told me and W is disabled and the string should be in there
<mrvn> jafarlihi: aslr just makes it harder, not impossible.
<mrvn> x8dcc: print the address
<zid> malloc shenanigans is usually how you do it
<zid> heap spraying
<immibis> things like ASLR are like additional obstacles, that may make exploitation impractical if you are lucky, but no guarantees.
<x8dcc> mrvn: I am already printing it and it is inside there
<zid> if you have an out of bounds write, you find a useful struct with a useful bit that appears early you want to flip
<immibis> they certainly make it more difficult
<zid> and do a bunch of useful allocations to make sure that struct is after the one you have an overflow in
<mrvn> x8dcc: and objdump -d shows code that will write to it?
<mrvn> x8dcc: you might need volatile
<zid> so memory map is like struct thing1 { int bob; char array_that_I_fucked[128]; } struct thing2 { int is_admin; ... }
<zid> now you don't need to bypass aslr
<mrvn> x8dcc: or make a function in a separate compilation unit and pass it the pointer, assuming you don't LTO
<zid> or NX
<zid> etc
<jafarlihi> But do you feel like it is just going to keep getting harder and then one day we will have next to zero exploitable memory bugs?
<zid> possibly, but there will always BE bugs
<mrvn> x8dcc: printing the string before and after can also force the compiler to actually write to the variable.
<zid> they just might not get leveraged so much
<zid> (which is already true)
<zid> lots of things are now DoS that would have been CVE
<mrvn> jafarlihi: if you don't want these kinds of bugs then don't use a language without bounds checks.
<x8dcc> mrvn: is literally what I am doing, " char* p = "Hello"; printf("(%p) %s\n", p, p); *p = 'Y'; printf("(%p) %s\n", p, p); "
<x8dcc> I am looking at the assembly but its weir
<mrvn> x8dcc: x8dcc: if you make a function "void modify(char *p) { *p = 'Y'; }" in a separate file then it might be easier to read. Should be easy to see the printf, modify and printf calls.
<x8dcc> okay, thank you
<immibis> zid: DoS bugs also get CVEs
<immibis> you might be thinking of RCE
bauen1 has quit [Ping timeout: 248 seconds]
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
jafarlihi has quit [Ping timeout: 248 seconds]
<x8dcc> it is writing to it fine... :(
<zid> immibis: yea I meant DoS CVE vs RCE CVE
<mrvn> what if I flood report CVEs from millions of hosts to make the CVE reporting server execute some malicious code? Is that a CVE DoS RCE CVE?
bgs has quit [Remote host closed the connection]
<epony> here is another childish joke:
<epony> At a conference of faux security all the talk is for obscurity, a Fedora next to RedHat in the middle sits a FedHat.
Gooberpatrol66 has quit [Read error: Connection reset by peer]
<epony> reserve all the CVEs ahead of time, use the "palindrome numbers and the equal digit ones first"
<epony> ^ if you're Microsoft and Apple, that's a standard procedure
<epony> so what can you do, but use the "inequal" ones then
<x8dcc> lame
<epony> some CVE recipients are more equal than others
<epony> remember what "security theatre" is called?
Gooberpatrol66 has joined #osdev
<epony> you know about the traded vulnerabilities market?
spikeheron has joined #osdev
<epony> not the obvious one where companies receive government security agencies funding and and tamper delegated control for profit, and not the one where support contracts are used to extort businesses and individuals to fix delayed security fixes..
<heat> just had a great nap
<heat> top nap really
<x8dcc> heat: I typed so many words today because of you
<heat> np
<heat> did you make it?
<x8dcc> uhm....
<x8dcc> kinda
<epony> but the one where rogue employees are covertly leaking bugs out to crime syndicate
<x8dcc> I learned a lot, thats for sure :D
<epony> and foreign governments
<x8dcc> heat: small update: I added 1:1 paging which works, and set all the rodata page frames to read only
<heat> cool, and it do the crash?
<x8dcc> no
<x8dcc> wait
<heat> note: doing comething like "char *str = "Hello"; *str = 'a';" will not work
<x8dcc> why?
<x8dcc> thats an interesting note...
<gog> string literals are not writable
<epony> cornrnenting
<x8dcc> gog: I know
<heat> because it's UB
<x8dcc> UB?
<heat> you need to make it so the compiler doesn't realize what's going on
<gog> undefined behaviour
<epony> unreliable brokerage
<heat> undefined behavior
<x8dcc> WELL I TRIED
<heat> gog british spelling poggers
<x8dcc> I changed so many things
<heat> man
<gog> heat: it's chewsday innit
<gog> wait it ain't
<x8dcc> man the compiler is too smart
<epony> lies
<gog> the compiler is not very smart actually
<x8dcc> I can't outsmart it
<heat> __asm__ __volatile__("mov $0, %0" :: "m"(*str) : "memory");
<x8dcc> well I am pretty dumb then
<heat> I think this works
<gog> nah it's easy to outsmart
<gog> like pointers
<epony> that's a very bad prognosis for your programming career
<gog> you can easily outsmart the compiler with pointers
<x8dcc> heat: probably last hour has been me trying to TEST the thing
<x8dcc> info tlb looks fine, by the way
<heat> like, an idea would be to get the function I gave you and put it in a separate compilation unit
<heat> then unless you have LTO, the compiler would not be able to see through it
<epony> you can become a cornpiler influencer ;-)
<x8dcc> wait I am going to try. My brain is going to explode
<heat> my asm snippet might actually work too
<heat> not guarantees
<heat> s/not/no/g
<x8dcc> I can't use it
<x8dcc> doesnt matter, I am going to try the other thing
<heat> yeah, does work. just replace mov with movb
<heat> why can't you?
<epony> internal restraints
bauen1 has joined #osdev
<epony> hesitations and doubts on top of scrupulous regrets
<x8dcc> heat: I tried your function in another file and nothing. Nothing meaning I can write.
<epony> remember when I told you that you need to change your compiler too, not just the kernel and your functions and libraries to store your new functions
<heat> can you try the asm?
<x8dcc> heat: I can't use it because of -masm=intel (I think)
<epony> some theatrical security believers in the "only language" change.. cause it's a VM anyway
<heat> 1) ew 2) ew 3) what is wrong with you 4) the adjustment is trivial
<x8dcc> heat: I am so mentally unstable right now
<x8dcc> I have been looking at numbers for the past 5 hours
<sham1> heat: don't eww Intel syntax
<gog> this is what happens when i declare a string char * asdf = "asdfasdfasdfas"; and then attempt to do *asdf = 'b'; it
<heat> __asm__ __volatile__("mov %0, $0" :: "m"(*strings[0].c_str()) : "memory"); <-- this works in gcc
<heat> for masm
<heat> =intle
<epony> my patch cake's better than yours, I can teach you, but you'll have discharge..
<x8dcc> I am having trouble with git now 1 sec AHHAHAHAA
<epony> this shovel is too soft
<gog> me too
<mrvn> heat: the compiler should not be smart enough to see through char* p = "Hello"; *p = 'Y';
<heat> erm. the compiler is
<gog> ok i have an unrelated phenomenon that i need help undersatnding
<gog> check out the timestamps
<x8dcc> heat: I literally have no idea how inline assembly works with intel syntax
<gog> is this something correcting my clock over-aggressively?
<x8dcc> I might continue tomorrow, I am really losing it
<gog> omg i happened again
<gog> 2215, 2214, 2215
<epony> sounds like Windows
<gog> i'm on linux bruh
<epony> then it's a VM
<gog> it's not a vm
<epony> then you're on ARM
<sham1> Well that's just the windows of the FLOSS world /s
<gog> this is a ryzen 5
<epony> then you're using swap and getting bursts of CPU load
<gog> i'm not using any swap
<sham1> Then you've hit a temporal anomaly
<mrvn> heat: gcc isn't. clang, oehm, what is it doing? https://godbolt.org/z/5T3z4d6fq
<bslsk05> ​godbolt.org: Compiler Explorer
<heat> x8dcc, on gcc, it's almost like a paste system
<epony> systems "lose time" compared to the wall clock (on your wall or realistic external clocks not part of the system)
<epony> when they are under heavy load
<epony> or entering SMM and doing APM / ACPI routines etc
<gog> ah.. hmm
<x8dcc> heat: well I made an *assembly function* and it still writes
<gog> ok i was running qemu the whole time
<mrvn> If clang sees that writing to a string is UB why is there no UB2 opcode?
<heat> gcc definitely recognizes what it's doing, it's just that the UB is making it crash at runtime if your strings are set up properly
<epony> could be the time routines in kernel get slightly skewed due to the KVM
<epony> use CPU counters instead
<epony> and compare
<heat> well, for one, because UB2 is not an opcode
<mrvn> heat: mov BYTE PTR .LC0[rip], 65 how is that seeing that you have UB?
<heat> secondly, because UB does not mean "here's a crash opcode"
<epony> or microtime / nanotime
<heat> because GCC can see through your shitty pointer, it's not rocket science
<epony> or check about "monotonic" time and its Linux implementation
<mrvn> gcc simply outputs code as if string literals where writable.
<heat> clang can do that. clang just skips it
<heat> that *does not* mean it doesn't know what it's doing
<epony> also you can check your kernel timesource and see if you have a better precision / reliability one to pick
<bslsk05> ​godbolt.org: Compiler Explorer
<epony> if you're in a VM there is a protocol to pass the system time to the guest, time flows different in the VM
<heat> gcc can see through all your pointers :))
<epony> and then the SMM you don't know / can't see, so.. microcode and firmware might screw with that too
<mrvn> heat: yes. But it does not see that writing through a pointer to a immutable is UB.
<mrvn> clang does see it and drops it because why not.
<heat> mrvn, do you actually believe the words you're saying or are you arguing with me because you want to (like usual)?
<gog> does irc send timestamps
<gog> why don't i know this
<epony> you can't rely on these ;-)
<heat> yeah
<x8dcc> heat: do you have any other way of checking the rodata write? it should be fine: https://temp.sh/cEwgs/ss-1675894988.png
<mrvn> heat: same to you
<gog> ok
<x8dcc> don't argue please :(
<gog> the answer is that libera supports server-time and my client is using it
<gog> and my clock is slow
<gog> i will close the file on this mystery now
<epony> you can't
<mrvn> x8dcc: why does _rodata_start point to the middle of a page?
<epony> I just gave you 12 more mysteries about time
<gog> i don't have time for that
<epony> timeouted
<gog> i read that in strong bad's voice
<mrvn> x8dcc: and _rodata_end points into a writable page. You screwed up your alignment.
<x8dcc> mrvn: oh my god what the hell
<x8dcc> it was not like that before
<x8dcc> I want to cry
<epony> use a GNU approved hanky
<heat> OH
<heat> LOL
<heat> DUUUUUUUUUUUUUUUUDE
<mrvn> x8dcc: other than that: WTF doesn't it fault? 10f000 is ---DA----. So the cou wrote to a unwritable page.
<heat> we forgot to set the WP bit in CR0
gorgonical has joined #osdev
<heat> hahahahahhahaa
<gog> oh yeah
<mrvn> x8dcc: as heat says. Check your flags. do you even have write protection enabled?
<x8dcc> hell no, I didn't even know I needed that
<mrvn> hehe
<gog> lmao
<gog> yeah ring 0 can write to pages not marked for writing :|
<mrvn> x8dcc: so 2 bugs to fix now.
<x8dcc> okay so... first: why on earth is rodata there
<x8dcc> mrvn: yeah, I love osdev
<mrvn> x8dcc: because the compiler has no idea you are doing things wrong.
<epony> and one more in the fix
<gog> did you specify in the linker script where rodata should be?
<x8dcc> gog: only alignment
<x8dcc> if I am understanding your question right
<gog> can i see your linker script
<x8dcc> sure, 1 sec
<mrvn> x8dcc: you should put your source into git and upload it to e.g. github
<x8dcc> mrvn: it is uploaded...
<bslsk05> ​dpaste.com <no title>
<x8dcc> mrvn: I upload everything I code to github
<mrvn> url?
<gog> ok can i see readelf -a of your image
<heat> x8dcc, you need . = ALIGN(4K); before the _blah_start end end
<heat> and end*
<gog> also that
<x8dcc> heat: oh shit you are right...
<heat> that is the exact problem
<mrvn> x8dcc: you need to align before the _start symbols.
<x8dcc> mrvn: https://github.com/fs-os/fs-os/ havent pushed today's hell, but check the wiki cuz its cool af
<bslsk05> ​fs-os/fs-os - Free & Simple Operating System (0 forks/4 stargazers/GPL-3.0)
<mrvn> ahh, heat spottet that too
<mrvn> x8dcc: I think you can move the _start symbols inside the blocks if you only care about _start being aligned.
<x8dcc> heat: should I just put them inside the { }? or align it outside or something. I have never used linker scripts before
<x8dcc> heh
<heat> . = ALIGN(0x1000);
<heat> .bss : AT(ADDR(.bss) - VIRT_BASE)
<heat> _bss_start = .;
<heat> {
<heat> *(COMMON*)
<heat> *(.bss*)
<heat> *(.gnu.linkonce.b*)
<heat> } : data
<heat> _bss_end = .;
<heat> _bss_size = _bss_end - _bss_start;
<heat> . = ALIGN(0x1000);
<heat> like this
<heat> you can also do the last . = ALIGN(0x1000); but then end - start won't give you the exact length of the section
<x8dcc> oh okay
<heat> you can do the last ... before _section_end I mean
<heat> if you do end = .; . = ALIGN(4K); you will need to manually round the end up to the next 4KB
<heat> when doing page prot calculations, etcc
<mrvn> what does BLOCK(4K) do in the linker script?
<mrvn> Hint: if you ". = ALIGN(0x1000);" before the _end symbols then you don't need to align the _start symbols (again).
<x8dcc> yeah I did that
<x8dcc> and I don't know what BLOCK(4K) does, it's from the bare bones guide. I know, I should not follow tutorials
<mrvn> x8dcc: have you tried setting the WP flag yet? Does it fault now?
<x8dcc> mrvn: no I haven't, 1 sec
<x8dcc> well now sections (and symbols) are actually aligned, which is great...
<x8dcc> oh my god
<x8dcc> FINALLY AN ERROR
<mrvn> BLOCK(align) You can include BLOCK() specification to advance the location counter . prior to the beginning of the section, so that the section will begin at the specified alignment. align is an expression.
<x8dcc> thank you all it finally fails
<x8dcc> I have never been so happy for an error in my life
<mrvn> x8dcc: seems you aligned twice, once with BLOCK and once with ALIGN
<x8dcc> mrvn: its in the bare bones wiki, I had no idea what I was doing (I just knew I was aligning because its good to align :D)
<mrvn> x8dcc: Sometimes the wiki authors just copy&paste stuff too. It's always good to investigate what stuff means before you copy it.
<mrvn> x8dcc: trust but verify. :)
<mrvn> x8dcc: and now that you have found the flaws in the bare bones wiki become a contributor and fix it.
<x8dcc> mrvn: yeah, I try to do that, but there is a point where I think I am getting too ahead of myself
<x8dcc> mrvn: well I didn't find it :p. I have made some small edits too, btw
<mrvn> x8dcc: baby steps. set yourself small goals. Like making sure writing to .rodata faults. That was a good next step.
<x8dcc> well that was thanks to heat to be honest
<x8dcc> I didn't even understand what I needed to "fix" to make his function crash
<mrvn> x8dcc: So now think of the next small thing to do. Maybe print out the memory map.
<x8dcc> next small thing to do is go to sleep
<mrvn> always a good plan.
<mrvn> commit + push first before you forget
<x8dcc> yeah yeah, I am doing it now
<x8dcc> I am still pushing to another branch lol. I will *try* to fix my heap tomorrow
<heat> the wiki's linker script is not wrong
<heat> x8dcc, np btw
* x8dcc shrugs
<heat> see documentation on the cr0 WP flag
<x8dcc> yeah, I searched it and now I have it
<heat> i'll leave this as an exercise to the reader, check the intel or amd manuals
<x8dcc> I have read the manuals, but there is just so many things lmao
<heat> you're not supposed to read them front to back
<x8dcc> I know, I know
<x8dcc> but still, my main problem is knowing what to search lol
<x8dcc> but anyways, thank you all for helping me, I learned a lot
<x8dcc> love you all and thanks for your time
<heat> np
<heat> next time you'll run in higher half
<heat> gl hf
bradd has quit [Ping timeout: 260 seconds]
x8dcc has quit [Quit: leaving]
<mrvn> it's not higher half. Pointers are signed and there is only one address space block. Run silent, run deep. :)
<gorgonical> why am I so dumb. I'm sitting here puzzling over why kitten won't print anything to the regular console and I realize it's because I forgot console=serial in the bootargs
<gorgonical> :(
<mrvn> It's so much easier to say: My kernel is at -2G
<heat> gorgonical, he not meow??
<heat> my cats dont support serial
<heat> i think. may check again later, is that a new update?
<gorgonical> they will on occasion eat cereal though
<gorgonical> i hope the first animal-human interface is rs-232
<gorgonical> so we can argue with our pets about whether carriage return or linefeed is better
<heat> they do different things
<heat> it's up for the cat's tty layer to do the appropriate translation
fedorafansuper has joined #osdev
<gorgonical> their KiTTY layer as it were
<heat> hehehehehahehehehaheahohohoeheuheheh
<heat> sorry, stroke
danilogondolfo has quit [Remote host closed the connection]
craigo has joined #osdev
<epony> the ICU gave up on you too
<epony> 13 minutes is not bad for an effort anyway
<gog> hi
<mrvn> gorgonical: KiTTY litter?
<epony> cucumber snake hosed cornellius snape
defaultxr has joined #osdev
heat_ has joined #osdev
heat has quit [Ping timeout: 248 seconds]