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
<geist> yep
<gog> all i wanted was a pepsi
<gog> i just wanted a pepsi, you wouldn't give it to me
<bslsk05> ​'MC HAMMER PEPSI COMMERCIAL -1990 - LONG VERSION' by Kmthirteens weird stuff (00:01:01)
<geist> stupid shit like that is seared into my brain
<heat> lol
<gog> google thinks i'm having suicidal ideation because i wanted to listen to the song "institutionalized" by suicidal tendencies just this moment
<geist> yah i was looking up 'like suicide' by soundgarden the other day and google thought i might need help
<kazinsal> yeah I found some weird combination of words a couple weeks back that made google ask if I was okay
<kazinsal> can't remember what it was
<heat> "reddit r/cpp"
<geist> haha
<nikolapdp> lol
<zid> nikolapdp p2'd yet?
MiningMarsh has quit [Quit: ZNC 1.8.2 - https://znc.in]
MiningMarsh has joined #osdev
vdamewood has joined #osdev
nyah has quit [Quit: leaving]
<heat> i think i have a bug in my nvme driver
<heat> some pages seem to be getting stuck in writeback
<zid> Okay, don't do that, bug fixed. That'll be 1 hour of consultation fees.
masoudd has quit [Quit: Leaving]
Arthuria has joined #osdev
gog has quit [Ping timeout: 252 seconds]
crmur__ is now known as orthoplex64
mavhq has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
mavhq has joined #osdev
<heat> there's actually a GNU social
* CompanionCube wonders if they ever did activitypub
gog has joined #osdev
Matt|home has joined #osdev
<zid> gnu social is where rms picks up hot parrots
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
<bl4ckb0ne> is this also where he does his nonce stuff
edr has quit [Quit: Leaving]
navi has quit [Quit: WeeChat 4.1.2]
heat has quit [Ping timeout: 240 seconds]
[itchyjunk] has quit [Remote host closed the connection]
Arthuria has quit [Ping timeout: 272 seconds]
JTL is now known as JLT
JLT is now known as JTL
pretty_dumm_guy has quit [Ping timeout: 276 seconds]
sbalmos has quit [Ping timeout: 256 seconds]
sbalmos has joined #osdev
smeso has quit [Quit: smeso]
mmohammadi9812 has joined #osdev
smeso has joined #osdev
klys has joined #osdev
<gorgonical> okay guys let's hear it
<gorgonical> who knows how I can avoid sleeping for more than 3 hours a night and being very productive and happy for those 21 hours
<gorgonical> I got a lot of shit I gotta do
<geist> lesson to learn: learn how your body reacts to sleep, how much you actually need
<geist> when you're young you can push it, but you can't do that forever
<geist> and you can't just plow through lack of sleep
<kazinsal> that or bolivian nose candy, but ymmv, also, hello officer, I'm just joking
<gorgonical> sometimes I consider doing that dymaxion sleep cycle but I'm a little afraid it would actually kill me
<kazinsal> I'm a big fan of taking an hour long nap if I can in the middle of the day
<kazinsal> means I can work properly on 5 hours of sleep
<gorgonical> hmm
<geist> yah, naps are pretty good
<gorgonical> One of my biggest obstacles to that sort of thing is I've noticed I don't learn anything if I'm too tired
<geist> i think ideally you get enough sleep that you dont need it
<geist> but otherwise naps do reset you pretty well
<kazinsal> hell even just laying down for an hour and turning your brain off is good, even if you don't actually get any sleep
<geist> what revolutionized napping in the afternoon for me is a good sleep mask
<geist> one that 100% seals off the night, after about 10 minutes my brain is like sleepy time, no matter what state i was in before
<geist> but it has to 100% be no light, not even a sliver
<gorgonical> I'm pretty sure if the sun stopped shining I'd get a 28-hour cycle
<gorgonical> If I don't have any external pressure my sleep cycle precesses around the clock
<gorgonical> requiring regular adjustment
<kazinsal> my internal clock is set to the drastically wrong time zone
<kazinsal> 6am-2pm PST works perfectly for my brain, which is a shame because that's australian eastern standard time
<geist> yah i know. i keep falling to something like 3-11
<geist> 8 hours, feels good, just right
<gorgonical> geist: that's basically what I'm at
<gorgonical> those same hours, too
<klys> I have a day job and don't balance my life well either, some late nights doom scrolling, some mornings at church, some evenings staring at irc, some nights out for activities like karaoke. well, I might actually be a better example than I think. yet I don't have it figured out at all.
<klys> the main thing I do with my time is try to make it to work early, and I am typically up to an hour early
<klys> most of my planning and thought management is in an outliner, the hierarchical notebook (hnb) on my cell using userland app. tines would work too if it just supported utf8.
<klys> and yes the process is occasionally reaped, though I was able to mitigate that with some advice about the process killer on android 13. I haven't upgraded to 14 yet.
rorx has quit [Ping timeout: 240 seconds]
<gorgonical> on my phone for note-taking I use orgzly, which works very well
<gorgonical> Although it is not emacs on the phone it has the same outline-based structure to it that org-mode does. I don't really understand what you mean about the process reaping and how that interacts with your note-taking though
<klys> well hnb saves a backup of the outline so long as it was scrolled through enough times before you saved it last, and there is space left on the device (a gotcha). so when I restart my process from userland at the $ prompt, it asks me if I want to restore from backup.
<gorgonical> oh it sounds like you're using termux or something then
<gorgonical> ?
<klys> userland
<gorgonical> oooh
<gorgonical> I see
<klys> so I also use sshd and tmux
<gorgonical> I didn't realize that was the name of one of these linux-like environments
<klys> to get a shell with android you want userland, afaict. also for AAPL, it would be iSH
<kazinsal> man this NHL season is weird
<kazinsal> Canucks are actually tied for most points in the league
<kazinsal> and Vegas is seven points behind
<gorgonical> I don't respect any team that basically acknowledges their moneyed nature
<gorgonical> Golden Knights?
<gorgonical> hmph
<kazinsal> I was in Vegas for the finals last year and it was *electric* in that city
mmohammadi9812 has quit [Remote host closed the connection]
<gorgonical> I was accidentally in Amsterdam when ajax won the national league
<gorgonical> That was wild
rorx has joined #osdev
Matt|home has quit [Quit: Leaving]
zetef has joined #osdev
netbsduser has joined #osdev
netbsduser has quit [Ping timeout: 272 seconds]
qxz2 has joined #osdev
bradd has quit [Ping timeout: 260 seconds]
bradd has joined #osdev
goliath has joined #osdev
zetef has quit [Ping timeout: 264 seconds]
kfv has joined #osdev
jack_rabbit has quit [Ping timeout: 276 seconds]
CutieMelo has joined #osdev
pretty_dumm_guy has joined #osdev
zetef has joined #osdev
zetef has quit [Ping timeout: 260 seconds]
gog has quit [Quit: byee]
gbowne1 has quit [Quit: Leaving]
Bitweasil has quit [Remote host closed the connection]
Bitweasil has joined #osdev
GeDaMo has joined #osdev
gog has joined #osdev
pretty_dumm_guy has quit [Ping timeout: 260 seconds]
pretty_dumm_guy has joined #osdev
Cindy has quit [Ping timeout: 268 seconds]
Cindy has joined #osdev
Left_Turn has joined #osdev
Cindy has quit [Ping timeout: 268 seconds]
mmohammadi9812 has joined #osdev
kfv has quit [Read error: Connection reset by peer]
kfv has joined #osdev
bauen1 has quit [Ping timeout: 276 seconds]
zetef has joined #osdev
zetef has quit [Ping timeout: 255 seconds]
mmohammadi9812 has quit [Ping timeout: 246 seconds]
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nyah has joined #osdev
kfv has joined #osdev
[itchyjunk] has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zxrom has joined #osdev
kfv has joined #osdev
edr has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kfv has joined #osdev
bauen1 has joined #osdev
[itchyjunk] has quit [Read error: Connection reset by peer]
edr has quit [Ping timeout: 256 seconds]
navi has joined #osdev
<Ermine> geist: https://github.com/littlekernel/lk/blob/master/arch/arm/arm-m/vectab.c#L52 -- where does this magic value come from? I found nothing relevant in ARMv7-m reference manual
<bslsk05> ​github.com: lk/arch/arm/arm-m/vectab.c at master · littlekernel/lk · GitHub
<gog> i can find no other reference to this value anywhere, it seems to be some magic value specific to lk
mmohammadi9812 has joined #osdev
<gog> hmm
heat has joined #osdev
edr has joined #osdev
<Ermine> Seems like something related to LPC-Link 2 debugger. I think now I want one
mmohammadi9812 has quit [Ping timeout: 252 seconds]
<heat> gog, D E B U G M Y C O D E
<gog> i'm busy debugging my own code
<gog> and failing because there's some spooky action-at-a-distance in a library and i don't know exactly where
<heat> have you tried turning it on and off
<heat> well, off and on
<heat> on and off would turn it off. which might be a good solution nonetheless
alpha2023 has quit [Read error: Connection reset by peer]
alpha2023 has joined #osdev
kfv has quit [Quit: Textual IRC Client: www.textualapp.com]
Left_Turn has quit [Ping timeout: 260 seconds]
m3a has quit [Ping timeout: 264 seconds]
bauen1 has quit [Ping timeout: 272 seconds]
bauen1 has joined #osdev
Left_Turn has joined #osdev
carbonfiber has joined #osdev
<Ermine> https://github.com/littlekernel/lk/blob/master/arch/arm/arm-m/start.c#L21 -- seems like __data_start is defined in an ld script. Why does one take its address instead of value?
<bslsk05> ​github.com: lk/arch/arm/arm-m/start.c at master · littlekernel/lk · GitHub
<zid> that's how linker scripts work
<zid> when you do BLAH = 5; that's setting blahs' *address* to 5
<zid> cus linker scripts only care about.. addresses
<zid> so if you want to retrieve the 5, you need to address-of operator the symbol
<gog> yes
<zid> (if you wanted to change its value, that'd be .somesect AT(0xdeadbeef) : { BYTE(5); } or something
<zid> but that makes your codegen change from mov rax, 5 into mov rax, [0xdeadbeef] which is.. silly
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
mxs has quit [Quit: The Lounge - https://thelounge.chat]
pg12 has quit [Remote host closed the connection]
Turn_Left has joined #osdev
* vdamewood moves 0xdeadbeef into rax and returns
Left_Turn has quit [Ping timeout: 268 seconds]
<Ermine> thx
* gog chomps 0xdeadbeef
<vdamewood> mov gog, 0xdeadf154
<heat_> Ermine, to be clear, a symbol's value is its address
<heat_> whether it points to something valid is another question
<heat_> it's slightly annoying because linker scripts are linker-centric and the C language is C-language-centric
<zid> Racist.
pg12 has joined #osdev
<heat_> what
zetef has joined #osdev
bliminse has quit [Ping timeout: 256 seconds]
bliminse has joined #osdev
zetef has quit [Remote host closed the connection]
<Ermine> C isn't quite clear about symbols
<Ermine> They didn't figure out whether variable name corresponds to symbol or to value the symbol points to
<zid> C doesn't have symbols
<zid> That's the entire point
<zid> There's no syntax to deal with them, so they just turn into pointers
<zid> which does have syntax
<zid> (which is perfectly acceptable and anything else would be pretty silly)
Left_Turn has joined #osdev
Turn_Left has quit [Ping timeout: 255 seconds]
<nikolapdp> ls -la
<zid> .
<zid> ..
<zid> honzuki/
<heat_> homework/
<nikolapdp> ls *
<zid> that's an incredible command
<nikolapdp> lol
<zid> echo * is equivalent, I expect?
<nikolapdp> no actually
<zid> it is on my machine, for the most part
<nikolapdp> ls * will list the contents of directories in cwd
<zid> the * is done by the shell
<nikolapdp> yes and * expands into all files in cwd
<zid> so you'r really doing ls Makefile cpu.c cpu.h cpu.o
<zid> which just.. prints those filenames
<zid> same as echo does
<nikolapdp> also ls honzuki/
<heat_> it's equivalent unless you have a dir
<zid> directories are cheating
<nikolapdp> better go back to fat12
<zid> The order is different, testing it
<zid> not sure why
<zid> is ls sorting
<gog> i don't believe in hierarchies and that applies to filesystems too
<zid> I'm a file communist
<gog> yes
<zid> all files are equal and flat
<nikolapdp> ls is sorting alphabetically
<zid> ls crazy
<zid> is there a glob
<zid> that includes dotfiles
<nikolapdp> well *. will
<heat_> probably
<zid> GLOBIGNORE
<nikolapdp> sorry, *.
<zid> apparently
<nikolapdp> .*
<nikolapdp> i can't type
<heat_> bbbbbbut that's not POSIX sh
<zid> .@(!(.|))
<heat_> why would you not write a POSIX sh compatible script
<heat_> POSIX is so useful and good
<heat_> extensions are bad and bloat :(
<nikolapdp> yes
<zid> oh right it's just
<zid> .* *
<zid> duh
<nikolapdp> that will also include . and ..
<zid> oh well
<nikolapdp> so be carefu
<heat_> ok lets try and make a POSIX variant of that
<heat_> give me 5
<nikolapdp> ye
<heat_> .* does not include . and .. here
<heat_> aha, bash
goliath has quit [Quit: SIGSEGV]
<nikolapdp> yeah
<zid> my GLOBIGNORE is not working
<zid> oh it works, just not inline
<zid> it has to be set *before* the command runs, obviously
<zid> so I need a ;
<zid> # GLOBIGNORE=".;.."; echo *
<zid> .git .gitignore Makefile
<nikolapdp> interesting
CutieMelo has quit [Quit: Quit]
CutieMelo has joined #osdev
<heat_> echo .* * | tr " " "\n" | grep -vE "^(\.$|\.\.)"
<heat_> paypal me money
<zid> Mine was easier heat
<heat_> yours doesn't run on freebsd
<zid> also I need you to un-tr it afterwards
<heat_> so if a freebsd user existed, they would need my variant
<zid> Right, if they did
<nikolapdp> can't you just | xargs echo
<nikolapdp> to untr it
<heat_> sure
<heat_> or tr "\n" " "
<zid> yea xargs echo works
<zid> no heat
<zid> that eats the *final* \n, we want that one
<heat_> darn
<nikolapdp> kek
<zid> you'd need tr "\n" " "; echo
<nikolapdp> so xargs is easier
<heat_> echo .* * | tr " " "\n" | grep -vE "^(\.$|\.\.)" | tr "\n" " " | xargs echo
<zid> find .
<zid> done
<heat_> paypal me 200 million euro
<zid> why are you tring AND xargs echoing
<zid> just xargs echo it
<heat_> no
<zid> yes
<heat_> no
<nikolapdp> yes
<heat_> no.
<zid> I literally did it on a terminal and it does it right
<zid> DESKTOP-VCLC0NQ ~/gameboy # ls | tr " " "\n" | xargs echo
<zid> Makefile cpu.c cpu.h cpu.o gameboy gameboy2 interrupt.c interrupt.h interrupt.o lcd.c lcd.h lcd.o main.c main.o mbc.c mbc.h mbc.o mem.c mem.h mem.o rom.c rom.h rom.o sdl.c sdl.h sdl.o timer.c timer.h timer.o
<zid> DESKTOP-VCLC0NQ ~/gameboy #
<heat_> i know
<heat_> but my way is disgusting-er
<nikolapdp> all of this is assuming you don't have spaces in your filenames
<nikolapdp> but we're on unix so of course we don't
<heat_> who
<heat_> what's this "spaces"?
<zid> find .
<nikolapdp> exactl
<nikolapdp> zid you need -maxdepth then
<zid> -d1
<zid> -print0
<heat_> find would also be a good option, it'd bring in this whole ass directory traversal code and regex and all that
<zid> -honzuki
<zid> %f
<heat_> it might be a better option than grep, grep just brings in regex
<nikolapdp> lol
<heat_> HOWEVER if we used ripgrep it'd spawn threads and use SIMD and all that
<nikolapdp> nonposix though
<heat_> right
<zid> # find . -maxdepth 1 -printf "%f\n" | xargs echo
<zid> works nicely
<nikolapdp> yea
<nikolapdp> nice
<zid> it includes . but not .. actually, that's weird
<nikolapdp> well .. doesn't actually exist, does it
<heat_> it does
<zid> neither does .
<heat_> .. and . exist
<nikolapdp> fair
<zid> either both or neither
<zid> it splitting them is odd
<heat_> no, it makes sense
<heat_> you give find ., and it'll iterate through .'s tree
<heat_> BUT looking at .. makes no sense, you'd be backtracking infinitely
<nikolapdp> oh yeah
<zid> . has .. in it, . does not have . in it
<nikolapdp> .. doesn't exist on .
<heat_> what
<zid> . and .. are both fake news
<zid> put there by big bash to sell more heirarchy
<nikolapdp> directories don't link to their parents
<heat_> it's an OpenVMS false flag attack
<zid> they don't link to themselves either
<heat_> nikolapdp, yes they fucking do
<nikolapdp> but you're giving it . explicitely
<zid> no, I gave it a symbolic "use cwd"
<heat_> how are you writing a filesystem again?
<zid> I rescan the entire fs forwards
<zid> when I do cd ..
<nikolapdp> obviously
<heat_> . and .. exist on-disk
<nikolapdp> so . points to itself?
<heat_> yes
<heat_> for a random directory: Links: 2
<nikolapdp> yeah parent and itself
<nikolapdp> got it
<heat_> 1st link is parent -> child, 2nd link is child -> child
<heat_> .. has a funny edge case where functionally .. != what's on disk
<heat_> in mount points
<zid> Nope, it's fake news
<zid> rescan the entire fs
<zid> I am a hunger
<nikolapdp> eat
<zid> The eats are encased in ice
<nikolapdp> wait
<nikolapdp> adn then eat
<zid> I don't think waiting will fix that
<nikolapdp> unless you live in a sub zero environment, it does
<zid> but the ice is always there
<nikolapdp> well separate it from ice
<zid> okay so take it out of the ice, leave it for.. 8 hours?
<zid> then eat it raw?
<zid> You're gross
<nikolapdp> lol
<zid> I think we need to transfer nikolapdp to an assisted living facility
<nikolapdp> rude
<zid> He can't hold down his lifestyle well enough to read a small light novel, and thinks you eat food by staring at it
<nikolapdp> well i do have exams at the moment
q3lont has joined #osdev
<zid> New international shipping issue just dropped
<zid> panama canal's too empty
Matt|home has joined #osdev
<nikolapdp> why would it be too empty
<zid> water's on holiday
<zid> (drought)
masoudd has joined #osdev
hoshi has quit [Ping timeout: 264 seconds]
<zid> I ignored your advice nikolapdp, I put it in the oven instead
<zid> It was nice
CutieMelo has quit [Quit: Quit]
CutieMelo has joined #osdev
dude12312414 has joined #osdev
<nikolapdp> that's nice zid
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 260 seconds]
CutieMelo has quit [Remote host closed the connection]
CutieMelo has joined #osdev
bauen1 has quit [Ping timeout: 272 seconds]
gog has quit [Quit: Konversation terminated!]
gog has joined #osdev
q3lont has quit [Ping timeout: 268 seconds]
incog has joined #osdev
masoudd_ has joined #osdev
masoudd has quit [Ping timeout: 272 seconds]
<heat_> mjg, mofo are you in favour of frame pointers in all software
\Test_User is now known as \Test_User|LC
\Test_User|LC is now known as \Test_User
<Ermine> wut
<mjg> i would be if they were necessary for reliable stacks
<mjg> but afair they are not
<mjg> linux kernel does without just fine
<mjg> ORC or somethin'
<zid> stack frames are for losers, objectively
bauen1 has joined #osdev
<heat_> yeah they use orc
<heat_> there's a new "universal" format in binutils, sframe
<mjg> which i presume does not require the frame pointer?
<mjg> why did you even ask
<nikolar> How does it work without frame pointers
<zid> you never needed them to begin with
<zid> They were just a hack at the expense of performance to make lazy tools easier to write
<bslsk05> ​docs.kernel.org: 9. ORC unwinder — The Linux Kernel documentation
<zid> like, a runtime stacktrace is a few lines of code if you have frame pointers, but is kinda hard without, so you need libunwind or whatever it's called
<mjg> what i find amusing is that this slightly predates cpu vuln craze
<mjg> that is to say .text got bloated big time with mitigations, mostly negating impact of ideas like orc
goliath has joined #osdev
<mjg> to make it worse they started adding hardening with extra impact on top
FreeFull has quit []
<mjg> it's basically microoptimize to save 2% and then add something which slows it down by 5
immibis_ is now known as immibis
<nikolar> Meh
<nikolar> If you microptimize enough, you're back at 0
<mjg> i believe they are mostly past the point where you can apply codebase-wide optimisations like that
<nikolar> Yeah that's fair
<mjg> well i have one idea which could shave some %
<mjg> annotating func as likely giving a particular result
<mjg> for example kmalloc almost always returning non-NULL
<nikolar> Don't they already have that in a bunch of places
<mjg> they have hand rolled (un)likely annotations
<nikolar> Maybe not for more "high-level" functions like kmalloc
<mjg> the point is to annotate the func itself
<nikolar> Oh interesting
<mjg> so that all uses get the hint automagically
<mjg> and some other frequently used stuff
<mjg> to the best of my knownledge compilers don't provide such an option though
<heat_> mjg, they're going to start compiling arch linux packages with -fno-omit-frame-pointer and -mno-leaf-something-something-frame-pointer
<mjg> so why did you ask
<heat_> and i'm wondering if taking the single-digit % perf hit (in microbenchmarks) is worth it for more observability
<mjg> but you don't get more observability
<mjg> if using ORC or the other thing
<nikolar> Dwarf?
<heat_> but most tooling does not support ORC or sframe
<heat_> and DWARF is lmao lol
<nikolar> Yeah lol
<heat_> you can't use DWARF when sampling stacks
<mjg> if for fuck all reason you can't get reliable stacks without the frame pointer
<mjg> you better keep it
<mjg> if only for crash analysis
<heat_> <heat_> but most tooling does not support ORC or sframe
<nikolar> Is sframe a standalone thing
lncog has joined #osdev
<mjg> so for example a distro wanting to ship without the frame pointer should patch local tooling to not need it
FreeFull has joined #osdev
<heat_> nikolar, wdym
<nikolar> Like does it depend on dwarf or whatever
<heat_> it's a standalone thing yeah
<zid> sframe sounds hando
<zid> .debug_sframe or is it going somewhere else?
<mjg> .debug_anime
<nikolar> .sframe apparently
<nikolar> https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=libsframe/doc/sframe-spec.texi;h=41f4ba17d83405ab62d10950248bbfd0300e2d4d;hb=c1c57352f56b802393453cfa76326922fd8da2f9
<bslsk05> ​sourceware.org: sourceware.org Git - binutils-gdb.git/blob - libsframe/doc/sframe-spec.texi
<mjg> let's be real tho, almost all perf loss in distros has nothing to do with this anyway
<nikolar> Oh absolutely
<bslsk05> ​sourceware.org: The SFrame Format
<mjg> and evrything to do with WEBDV
<zid> oh libsframe too, nice
incog has quit [Ping timeout: 246 seconds]
<zid> like libstacktrace but way less code presumably
<mjg> The SFrame format is currently supported only for select ABIs, namely, AMD64 and AAPCS64.
<heat_> it's only lacking in SPARC support
<zid> megasparc when
<heat_> hello mr lary elison
<heat_> megasparc??
<heat_> thank, heat
<zid> sparc -> ultrasparc -> megasparc
<nikolar> What about gigasparc
<mjg> heat_: why do you know about arch plans btw
<mjg> sounds like a non-enduser detail
<mjg> are you turning into an ARCH DEV
<zid> We don't have enough sand on the planet
<mjg> they have gigasparc in Dune
<nikolar> Lol
<gog> we have sparcsign the likes of which god has neveer seen
* mjg throws gog a snack
<zid> By which I mean, sparc lovers are masochists who like to rub sand into their eyes for fn
* gog chomp snack
<zid> so we'd run out if a gigasparc was released
<gog> what if i got a sparc
<nikolar> I want a sparc
<gog> does geist have a sparc
<zid> gog: The sand comes with it in a little cup
<zid> like the mint sauce the indian place gives
<geist> geist has a sparc
<zid> or salad
<gog> that doesn't sound liek its' very useful for computing
<gog> i knew geist had a sparc
<geist> SPAAAARC
<zid> sparc is not useful for computing, no
<geist> aww you're just in the delay slot, zid
<gog> it has so many registers
<gog> how do you even use all those registers
<zid> Easy, with a bad compiler
<mjg> gog: poorly
<mjg> :X
<gog> dang i need to write a bad compiler
<mjg> wash your register window
lncog is now known as incog
<heat_> mjg, i follow ARCH LINUX DEVELOPMENT
<zid> LORD NITO IS COMING :o
<mjg> heat_: are you sure you kissed a girl at some point
<mjg> heat_: was it your mom
<heat_> mom is woma
<heat_> quite ironic accusations coming from a BSD DEVELOPER
CutieMelo has quit [Ping timeout: 246 seconds]
CutieMelo has joined #osdev
<mjg> there is a number of BSD DEVELOPERs which kiss BOYS
<mjg> not that it's me tho
<heat_> boy kissing?
<heat_> i thought that was reserved for rms
<zid> heat you don't need to explode with jealous every time
<bslsk05> ​www.theonion.com: 10-Year-Old Denies Girl-Liking Allegations
<Ermine> Seems like -mcpu=cortex-m4 does not imply -mthumb
<heat_> haha
<nikolar> Ermine: should it
<nikolar> I know cortex m0 is thumb only
<heat_> cortex m4 has 5 fingers, not just the thumb
<heat_> follow me for more HILARIOUS CPU jokes
<nikolar> Kek
<nikolar> You still have to explicitly request thumb on m0
<mjg> how is your internet philipina girlfriend doing
<Ermine> m4 is thumb only too
<mjg> still needs money for hospital bills?
<geist> Ermine: that's odd. are you sure?
<heat_> yes, she keeps asking me for money
<heat_> but i love her so much <3
<zid> heat never gives me money :(
<bslsk05> ​github.com: lk/arch/arm/toolchain.mk at master · littlekernel/lk · GitHub
<Ermine> geist: gcc generated even addresses which caused usagefaults
<geist> are you sure that isn't something to do with linking in the wrong libgcc?
<geist> because your multilib didn't match?
<geist> that's a very common problem, since it's based on precisely how your toolchain does the multilib matches
<Ermine> I think I use libgcc shipped by arm-arm-none-eabi-gcc
Goodbye_Vincent has quit [Ping timeout: 264 seconds]
<geist> that really matters, yo ushould figure out precisely which libgcc you're using
neo_ has joined #osdev
<geist> there are usually multiple ones, and they match differently based on the precise switches you use
<geist> and if it tries to link in a 32bit arm one, or say thumb2 on a thumb1 devices (cortex-m0) then you'll get what you got
<geist> but OTOH if adding -mthumb fixes your problem *shrug*
<geist> but be careful it doesn't limit it to thumb1
<heat_> this is so embedded i'm getting SICK
<heat_> how many dozens of cpus are yall running
<geist> well, to be fair ARM32 embedded and libgcc and whatnot is a huuuuuge PITA
<geist> there are so many variants of incompatible code it's annoying as fuuuuuuck
<geist> one of the things i love so much about working with arm64 vs 32
<heat_> a few days ago they were discussing in #armlinux an opcode that has multiple valid instructions, depending on the variant you're using
<heat_> you need to pass some args to objdump to get it to properly decode
neo|desktop has quit [Ping timeout: 252 seconds]
<geist> yeah probably a case of interpreting thumb as arm or vice versa
<geist> since there's a modal shift between the two there's no consideration for making one match existing isas structure wise
<geist> that's a nice thing riscv c extension solved
<Ermine> geist: yeah, seems like you're right: it uses lib/arm-arm-none-eabi/13.2.0/libgcc.a
<heat_> wldrd wr10, [ip], #8
<geist> at the expense of using up a sizable chunk of the riscv opcode space
<nikolar> What, it's modal??
<nikolar> Oh gross
<heat_> vs ldfp f2, [ip], #8
<Ermine> but there's thumb subdir
<geist> nikolar: yeah you switch between modes basically by jumping to an odd address
<geist> ie, pc[0] is functionally the mode you're in
<nikolar> Lol cursed
<geist> it's not as bad as you think, but it does mean it's basically on a function by function basis
<heat_> -miwmmxt switches ldfp to wldrd
<geist> but it cleanly allows you to switch between
<geist> heat_: ah okay, well iwmmxt is basically non-canonidcal
<nortti> was thumb introduced before or after arm dropped 26-bit?
<geist> sort of like Legacy Star Wars
<geist> nortti: far after
<Ermine> So how do I link the right libgcc?
<geist> Ermine: add -mthumb
<heat_> step 1: don't linke libgcc
<geist> your particular toolchain is linked to multilib match that way, and so there you go
<nortti> geist: aw, so no both flags + thumb flag in PC combo setup possible
<geist> heat_: not really feasible with thumb
Goodbye_Vincent has joined #osdev
<heat_> :(
<geist> er cortex-m really
<geist> the instant you use any 64bit, boom libgcc
<geist> or divides
<Ermine> I guess I should add it as flag to ld as well?
<heat_> fyi
<geist> nortti: yeah that went away. in armv4 i think (or maybe v3) they moved all the PSR bits out of the top of the PC into CPSR, and thus the clean transition was gone
<heat_> this is why i ship my own compiler-rt copy and compile it from scratch
<geist> Ermine: depends a lot on how you drive the compiler specifically
<geist> heat_: this is also why i build my own toolchains with the multilib matching carefully tweaked
<heat_> it's *really* hard to know how multilib was configured, how libgcc was built, and how they mix and match with your custom-ass options
<geist> yah, you can dump it, but it doesn't help your build system
<geist> something like --print-multilib-match
<geist> or somethingl ike that
<geist> i dont have it handy
<geist> ah --print-multi-lib
<Ermine> gcc -Wl,--verbose $(CFLAGS) -o $@ -T boot/firmware.ld $(OBJS) $(LDFLAGS)
<heat_> riscv is really nice in the way that it just stops linking if it finds you're mixing too much stuff in objfiles
zid has quit [Ping timeout: 256 seconds]
<bslsk05> ​IRCCloud pastebin | Raw link: https://irccloud.com/pastebin/raw/kYpUuTq7
<nortti> geist: aiui there was a time when 26-bit and 32-bit were both supported, think some strongarms have that
<geist> thats for example a multi lib matcher logic from my toolchain
<geist> it's telling you what combination of flags generates a custom multilib path
<heat_> yeha
masoudd_ is now known as masoudd
<geist> ah, so you're using gcc's selectoin of libgcc
<geist> so yeah look at --print-multi-lib and see
<geist> but really what you found is what you need, add -mthumb and move on with life
<geist> it's an overspecification, but so it goes.
<heat_> but yeah, i strongly recommend building compiler-rt
<heat_> it's very compatible with libgcc
<geist> some day i'll ask you how that works heat
<heat_> and doesn't require mucking around with gcc multilib
<Ermine> I've added -mthumb and it didn't work
<geist> but not today, i've never fiddled with copiler-rt
<geist> i thought you told me when yo uadded it it *did* work?
<geist> can you pastebin the --print-multi-lib?
<heat_> geist, yeah
<Ermine> well, it worked on a test code which didn't link libgcc at all
gbowne1 has joined #osdev
netbsduser has joined #osdev
<heat_> using gcc multilib is annoying in the sense that it compiles every runtime lib multiple times
zid has joined #osdev
<heat_> which sounds totally ok, but when it comes to user vs kernel you really only need libgcc
<heat_> no one cares if libstdc++ is built -mcmodel=kernel -mno-red-zone
<geist> well, no not really. when it comes to ARM you have to compile it multiple times for the different variants
<geist> compiler-rt would have exactly the same problem
<geist> Ermine: oh wow. i dunno what to do with that to be honest
<heat_> yes, i'm not disputing that
<geist> Ermine: that is woefully underspecified, looks like you have exactly two libgccs, though the second one is what you want
<geist> you can always manually link in the appropriate libgcc.a
<geist> depends how tied you are to that specific toolchain
<heat_> its just that you generally don't need libstdc++ and libasan and whatnot in -mcmodel=kernel -mno-red-zone, and (AFAIK) there's no way to tell gcc to just compile a single lib in that multilib config
<geist> heat_: oh absolutely
<geist> my doit script does
<heat_> oh yeah?
<geist> well, it builds *all* of the libgccs, but nothing else
<geist> just libgccs for all the multilib variants
<geist> each of which takes like 2 seconds
<Ermine> I think I'll go with compiler-rt
<heat_> ah ok
<Ermine> Is it available as standalone tarball?
<heat_> i'm not sure
<bslsk05> ​github.com: toolchains/doit at master · travisg/toolchains · GitHub
<heat_> Ermine, there's some light patching you need to do in order to get it to fully build with gcc
<geist> Ermine: if you use a posixy system you can use my script to build your own
<geist> or find one in https://newos.org/toolchains
<bslsk05> ​newos.org: Index of /toolchains
<geist> those are all hand built by me
<bslsk05> ​github.com: History for kernel/lib/compiler-rt/builtins - heatd/Onyx · GitHub
<geist> but either way if you use a manaul libgcc or compiler-rt you'll have to change your link line to either use ld directly and specify the path to libgcc.a (which is what i do)
<geist> or find the right flag for gcc to remove any auto-linkage of libgcc
<geist> probably something like -nostdlib or whatnot
<heat_> -nostdlib
<Ermine> geist: thank you!
<geist> as a general rule you probably want to do that (-nostdlib)
Goodbye_Vincent has quit [Ping timeout: 252 seconds]
<geist> and then you can find the libgcc it wants by using `gcc $(cflags) --print-libgcc`
<geist> it'll give you the path to libgcc that it would select given that combination of cflags. i use it in the LK build system to save it into a variable
<geist> and then just put it at the end of the ld link line
<heat_> yeah i did that too
<geist> geist@m1pro:~$ arm-eabi-gcc -mcpu=cortex-m4 --print-libgcc
<geist> /Users/geist/toolchains/Darwin-arm64/arm-eabi-12.2.0-Darwin-arm64/bin/../lib/gcc/arm-eabi/12.2.0/thumb/v7e-m/nofp/libgcc.a
<geist> for example
<heat_> i still do for crtbeginS and crtendS, but i should probably not
<heat_> every time i look at my makefile i see a remarkable number of hacks
<heat_> probably what most kernel makefiles turn into over time
<geist> yah i dont use any of the crtbeing stff or whatnot. that's where i do everything manuyally
<geist> well, except for the lkuser bits, but that's a different build system
<heat_> i don't exactly remember what crtbegin/end do (except that they call constructors)
<heat_> i probably don't need them, but it works, so don't touch it for now
<geist> yah i do that manually in the kernel so i can control precisely where
<heat_> i call _init and init_array
<heat_> and IIRC crtbegin fills in _init
<Ermine> print-libgcc points to the correct libgcc
neo_ is now known as Neo
Goodbye_Vincent has joined #osdev
<Ermine> Well, how about that: gcc -mcpu=cortex-m4 -mfloat-abi=hard --print-libgcc gives non-thumb libgcc
Goodbye_Vincent has quit [Ping timeout: 260 seconds]
Left_Turn has joined #osdev
EliotVonEcklie has joined #osdev
Turn_Left has quit [Ping timeout: 272 seconds]
Goodbye_Vincent has joined #osdev
EliotVonEcklie has quit [Client Quit]
<geist> i dont think you have enough libgccs in your toolchain
<geist> it doesn't have the right combination of thumb + hard float
<Ermine> fun
Goodbye_Vincent has quit [Ping timeout: 264 seconds]
Turn_Left has joined #osdev
Goodbye_Vincent has joined #osdev
Left_Turn has quit [Ping timeout: 240 seconds]
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
heat_ has quit [Remote host closed the connection]
heat_ has joined #osdev
masoudd_ has joined #osdev
masoudd has quit [Ping timeout: 260 seconds]
CutieMelo has quit [Quit: Quit]
CutieMelo has joined #osdev
CutieMelo is now known as b
b is now known as CutieMelo
gbowne1 has quit [Remote host closed the connection]
gbowne1 has joined #osdev
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
carbonfiber has quit [Quit: Connection closed for inactivity]
goliath has quit [Quit: SIGSEGV]
<gorgonical> I think I may have just been sniped by the semantics of unlinking an open file
<nikolapdp> oh how
<gorgonical> When someone unlinks a file we are assuming the normal usage, that you wouldn't unlink an open file. So unlinking immediately de-allocs kernel structures and fs private data. But sqlite in particular basically does an immediate open->unlink->use thing
<gorgonical> To make sure nobody else can access their filesystem tmp files
CutieMelo has quit [Remote host closed the connection]
CutieMelo has joined #osdev
<gorgonical> So now I think I have to implement free checking on close() to see if the inode's been unlinked and the refcount has hit zero
<gorgonical> This sort of smells like use-after-free on purpose though
<gorgonical> lol
<nikolapdp> i mean that's the expected behaviour
<nikolapdp> the file exist until the last handle is closed
<gog> yes
<gorgonical> hmm
<gorgonical> I know that's the behavior but it rubs me the wrong way for some reason
<zid> -1 files open.
<nikolapdp> because of that, zfs needs to put it in the special list of pending deletes if you snapshot an unlinked file that's still being used
<gorgonical> zid: implying that unlink just does an decrement of the open count?
<zid> nikolapdp: FATAL("nikolar didn't read enough honzki", SEND_DEATH_SQUARDS);
<zid> I spel gud
<nikolapdp> zid relatable
<zid> gorgonical: You need a refcount to unmap it from memory, at least
<zid> else you can't do shm filey stuff
<gorgonical> creates a weird disconnect between calling unlink and actually doing it though
<gorgonical> inode_op->unlink will only get called somewhere in close(), sys_unlink just decrements the refcount, lol
jack_rabbit has joined #osdev
pretty_dumm_guy has quit [Quit: WeeChat 3.5]
[Kalisto] has quit [Read error: Connection reset by peer]
[Kalisto] has joined #osdev
<zid> nikolapdp:
<zid> zid: real macedonia, or the fake on in greece?
<zid> guccirodakino: Fuck you
<zid> My greek friend is fun
<nikolapdp> lol
<nikolapdp> you mean south serbia
<zid> I think we should give fake macedonia to serbia
<nikolapdp> yes obviously
<zid> And real macedonia to kosovo.
<nikolapdp> which is serbia, so again, yes
<zid> no it isn't? Full independent country.
<zid> Doesn't need no man.
<nikolapdp> yeah that's why the albanians are leaving en masse
<nikolapdp> have fun with them over there
<zid> Albanians are just the mafia right?
<nikolapdp> basically
<heat_> gorgonical, linux even has the capability to re-link an unlinked file
<heat_> a file with no names on the filesystem
<heat_> or to create a file that ever had a name (O_TMPFILE)
<heat_> s/ever/never/
Left_Turn has joined #osdev
<nikolapdp> heat_ how does that work
<heat_> what work
<nikolapdp> do you have a syscall to which you give the fd and path or something
<nikolapdp> relinking
<heat_> linkat
<heat_> see AT_EMPTY_PATH
<nikolapdp> huh interesting
<heat_> wait, they disallow unlink() + link() for some reason
<heat_> but you can link O_TMPFILE anyway
Turn_Left has quit [Ping timeout: 260 seconds]
<zid> nikolapdp: greekfriend: "Personally I consider Kosovo a country, but not Serbia"
<nikolapdp> well that's disappointing
<zid> is he wrong?
<nikolapdp> what do you mean
<zid> serbia is at best, a nato administrative distract
<zid> kosovo is the country
<nikolapdp> are you implying that kosovo is more independent than serbia
<heat_> freebsd does not have this special gotcha, linkat(AT_EMPTY_PATH) can link any nlink = 0 fd without any problems
<heat_> always liked freebsd
<nikolapdp> BSD BSD BSD
<heat_> shame that no one uses it
<zid> nikolapdp: What implication? Non-countries are not countries. Nothing implied, just saying it.
<nikolapdp> heat_ in what situation do you really need to relink a file
<heat_> i don't know
<mjg> accidental deletion
<heat_> xD
<nikolapdp> lol
<zid> people playing silly games
<zid> is what half of POSIX exists for
<nikolapdp> this is not posix zid
<geist> O_TMPFILE + linking it after the fact might be useful, because you could do something, and then link it at the end
<heat_> i don't know why you'd need to relink a file, but IMO there's no particularly reason why you shouldn't be able to
<nikolapdp> that's fair
<heat_> particular*
<heat_> and UNIX should be the bald eagle of operating systems apis
<heat_> you should be able to do everything
<geist> backup i guess. maybe you're doing something where you're hard linking a list of files, and one process is iterating through it, and the other is deleting it at the same time?
<nikolapdp> maybe some unix had a weird fs implementation that didn't handle that correctly
<geist> but then you probably wouldn't link by fd
<nikolapdp> so posix doesn't mandate ti
<heat_> posix doesn't mandate this flag at all
<nikolapdp> yeah my point
<zid> posix only mandates bizzare stuff, this seems useful
<zid> so no posix
<nikolapdp> lol
<heat_> POSIX has to be the lowest common denominator
<heat_> hence, useless
<nikolapdp> *mostly useless
<nikolapdp> kind of surprised stuff like asprintf took so long to get standardized
<heat_> was it?
<heat_> strdup is peak C23 technology, don't forget that
<nikolapdp> oh yeah i probably thought of strdup
<geist> asprintf sounds kinda difficult to implement when you think about it
<geist> since it doesn't know how big it is before it prints
<nikolapdp> well snprintf gives you how much you need to allocate when you pass it null
<geist> almost have to make two passes on it
<nikolapdp> so it's actually trivial
<geist> well, trivial in a terribly inefficient way
<heat_> yeah asprintf is doable if you add your own FILE implementation, that allocates the buffer
<geist> ie, make two pass over it
<nikolapdp> yeah i know
<geist> but i guess you could basically realloc as you go
<heat_> you don't want a crap implementation, hopefully
<sortie> geist, I have vcbprintf that invokes the provided callback as the printf backend, vasprintf uses a callback that uses realloc to grow the buffer as it is produced
<nikolapdp> there we go
<heat_> yeah
<nikolapdp> dynamic array type of thing
<heat_> musl and glibc AFAIK use vfprintf as the backend
<geist> yeah, i guess you could do a quick strlen pass on the fmt and decide it cant really be any shorter than that
<acidx> yeah, if you have realloc it's better. if not, gotta do two passes with something like snprintf
<geist> and use that as your starting point
<nikolapdp> so they do the two pass thing then
<heat_> no?
<heat_> single pass
<sortie> heat_, one nice thing is that I can cut the FILE stuff out of the kernel
<nikolapdp> heat_ oh so it's a custom FILE then
<heat_> yes
<nikolapdp> neat
<heat_> for them, snprintf is also a custom FILE
<heat_> for more info, see fopencookie
<nikolapdp> why that name though lol
<heat_> bad naming + cookie can be generally described as "something you pass to a function, so that later callbacks pass that back to you as an argument"
<acidx> if you use fopencookie in europe, you must show a pop-up to the user about cookies
<sortie> acidx, no, only if you use setlocale
<sortie> LC_ALL=C cookies are fine
<heat_> fshowgdpr
<nikolapdp> what about in uk
<nikolapdp> is it fopenbiscuit
<zid> a cookie and a biscuit are not the same thing
<nikolapdp> zid it's called a joke
<zid> It doesn't function
<nikolapdp> we broke zid
<sortie> nikolapdp, in the UK you must call brexit() instead of exit
<nikolapdp> ke
<heat_> doesn't function?? but fopencookie() is a function?
<nikolapdp> kek
<zid> see that's a joke
<nikolapdp> very clever, yes
<klange> i don't give a function
<heat_> i don't give a fork()
<nikolapdp> now there are two heats
<zid> american fork() should be called ladle()
<zid> nikolapdp approved joke
<heat_> sortie, i don't share the libc with the kernel. but FILE isn't a bad abstraction, it just has a weird name + some file related baggage
<nikolapdp> it can be really neat
<acidx> posix_spawn() should be implemented by a spork() function call (spawn + fork)
<nikolapdp> has anyone here used posix_spawn
<heat_> yes
<zid> s/here /
<sortie> heat_, I mean I do have open_memstream as such as in the freestanding libc yeah
<nikolapdp> kek
<nikolapdp> heat_ is it really so much better than fork+exec as people on the internet say
<sortie> Though most of this *f* stuff is not used
<heat_> posix_spawn is easy to use if the use is trivial, awful to use for anything else
<heat_> performance-wise, it'll be much better than fork() + exec(), and comparable to vfork() + exec()
<nikolapdp> interesting
<nikolapdp> isn't it supposed to work better with open file handles and whatnot
<heat_> but the main idea behind posix_spawn is that it *can* do vfork() + exec() and still do complex operations after process creation
<zid> I just use execpveceexpat
<heat_> like, vfork() and not calling either _exit or exec() is UB, but a good implementation can switch your stack temporarily and thus do a lot more stuff
<nikolapdp> that stack would need to be static right
<nikolapdp> dynamic allocation sounds like a bad idea post vfork
<heat_> you can do it pre-vfork
<nikolapdp> oh yeah duh
<heat_> linux vfork()/clone(CLONE_VFORK) waits for the child to either exit or exec
<zid> I am officially out of vindaloo
<zid> now what
<klange> buy more vindaloo
<klange> or if you made it, make more
<zid> you can't *make* vindaloo
<zid> It comes from special vindaloo cows in india
<heat_> my ancestors went around africa for that
<heat_> if you really want more, you better get to work
<klange> ah, yes, those special vindaloo cows... also known as "pigs"
<nikolapdp> i mean zid's ancestors also went around africa for that, and much more
<zid> it was chicken actually, but it's the sauce I ran out of
<zid> I ate the chicken first
<zid> then used the sauce for a bunch of things
<zid> like, split it into vindaloo'd chicken, and vindaloo sauce
<heat_> nikolapdp, note: vfork really matters, fork sucks, and whoever tells you fork is now Just As Fast is lying or misguided
<zid> It is for example, a most excellent dipping sauce for cheese pizza
<nikolapdp> heat_: vfork does almost trivial amount of work while fork needs to copy the address space and stuff, but i guess with cow, it's "acceptable"
<heat_> it's not acceptable
<zid> heat_: Does portugal have goats?
<heat_> yes, ronaldo
<nikolapdp> i am just summrizing the consensus
<heat_> next!
<heat_> also figo
<heat_> and eusebio
<nikolapdp> btw i love how the first thing that shows up when you search for vfork calls it an obsolete syscall lol
<zid> It is though
<heat_> no
<zid> we have posix_frogspawn now
<heat_> POSIX marked it obsolete, because some systems think fork is Just As Fast so they don't want vfork
<nikolapdp> posix_gogspawn
<heat_> (and it shows POSIX is absolutely useless)
<zid> gogix_pogspawn
<heat_> by the way fork() is not supported on no-mmu systems usually
<nikolapdp> it's not even good at reflecting what's de facto standardized
<nikolapdp> lol you'd have to do a bit memcpy
gog is now known as pogspawn
<nikolapdp> wonder why they obsoleted vfork when it's almost trivial to have if you support fork
<heat_> you'd need to adopt some old PDP11-UNIX-like swapping mechanism
<zid> pogspawn: is it true that people in iceland believe photographs steal a portion of your soul
<nikolapdp> ironically, pdp11's usually have an mmu
<heat_> nikolapdp, because of idiots saying COW is just as fast as doing an atomic++
<pogspawn> zid: yes
<zid> is there any lore on how this interacts with gingers, do they go negative?
<nikolapdp> heat_: as if cow wouldn't have many atomic++ thoroughout
<zid> or maybe it's 0 * 0.8 = 0
<heat_> nikolapdp, right :)
<nikolapdp> lol
<nikolapdp> also why is stuff like swapcontext removed from posix as well
<pogspawn> zid: idk i'm not a ginger?
<pogspawn> am i?
<zid> Maybe don't eat the next one you see, and ask them a couple of questions first
<heat_> nikolapdp, hah
<heat_> >With the incorporation of the ISO/IEC 9899:1999 standard into this specification it was found that the ISO C standard (Subclause 6.11.6) specifies that the use of function declarators with empty parentheses is an obsolescent feature. Therefore, using the function prototype:
<heat_> void makecontext(ucontext_t *ucp, void (*func)(), int argc, ...);
<heat_> >is making use of an obsolescent feature of the ISO C standard. Therefore, a strictly conforming POSIX application cannot use this form. Therefore, use of getcontext(), makecontext(), and swapcontext() is marked obsolescent.
<zid> argc has to be first?
<nikolapdp> don't tell me it's because of the signature and nothing else
<heat_> yep
<nikolapdp> that's ridiculous
<Griwes> that's really funny given that C23 makes void foo() equivalent to void foo(void)
<heat_> well that's fair enough
<zid> do we have makecontext2() yet
<zid> with argc first
<nikolapdp> they couldn't have just defined it to take a void * or something
<heat_> you can't convert a function pointer to a void *
<Griwes> *technically* that's an illegal conversion
<zid> -pedantic gets angree
<heat_> the Queen's C doesn't allow for that
<Griwes> but then... dlsym
<zid> but yea, dlsym is also illegal
<nikolapdp> no i meant for the void (*func)(void *)
<zid> which is why that rule is silly
<zid> if we had templates then sure whatever I guess, but we don't
<heat_> nikolapdp, because the function takes N args, which you specify in makecontext
<nikolapdp> variadic then?
<nikolapdp> there's no way this coudln't have been fixed
<heat_> the interface your describing would *not* be makecontext. hence obsolescent
<Griwes> just make the callback take a va_list then :V
<zid> makecontext2
<nikolapdp> but it wasn't replaced by anything
<zid> lstat64
<zid> how bad was the interface to stat
<zid> such that we're on revision 64
<nikolapdp> lol
<acidx> accept4
<Griwes> open69
<acidx> we should make makecontext1, makecontext2, makecontext3, ..., makecontext1000
<acidx> and get rid of argc
<nikolapdp> lol
<acidx> so the prototypes internally are fully defined
<zid> acidx: encode the arguments to the () part in the name
<zid> makecontextint3long4char1
<acidx> perfect
<acidx> :shipit:
<heat_> that's a genius idea zid
<nikolapdp> so we're basically at the cpp name mangling
<heat_> now, that symbol name is too long, we might need to compress it
<Griwes> only worse due to not being (almost?) turning complete
<zid> can we base64 it
<zid> to make it longer
<Griwes> (yes you can *almost* write arbitrary programs with the itanium name mangling, don't ask me why I know)
<nikolapdp> is there a maximum symbol name length in elf
<nikolapdp> Griwes: why do you know
<nikolapdp> or even better, how
<heat_> in ELF? like 4G
<nikolapdp> kek
<zid> is that not string tabled with the pascal 1 byte string thing
<zid> or was it windows that does that
<zid> or did I hallucinate
<heat_> yes, it's string tabled
<zid> heat you can't just ignore the clause at the end
<heat_> what's the pascal 1 byte string thing?
<nikolapdp> you hallucinated
<zid> 0x4,"help"
<zid> pascal string
<zid> 1 byte
<heat_> yes
<heat_> wait
<heat_> no
<nikolapdp> lol
<heat_> ELF strings are zero terminated
<zid> So either it might be ATOMS in pe that are like that then, or I was hallucinating, that's 1/3 options solved
<nikolapdp> told ya > <nikolapdp> you hallucinated
Left_Turn has quit [Read error: Connection reset by peer]
netbsduser has quit [Ping timeout: 256 seconds]
heat_ has quit [Ping timeout: 268 seconds]
heat has joined #osdev
<heat> so i just found an exploit in my insmod syscall
<mjg> plz stop confusing "vulnerability" with "exploit" kthx
<heat> everybody gangsta until infosec mjg shows up
<nikolapdp> lol
<mjg> did you know i found a VULNERABILITY in solaris kernel?
<mjg> true story
<mjg> arbitrary code execution in kernel mode
<nikolapdp> ynice
<zid> did you forget to check uid
<nikolapdp> lol
<zid> or was it a TOCTTOU and you allow setuid things to be insmodded by anybody
<zid> fun fact, serbia exists because of a TOCTTOU bug
<nikolapdp> and what bug would that be
heat_ has joined #osdev
<zid> NATO asked if anybody lived there, and a jokester in kosovo said yes
<shikhin> What's the difference between a vulnerability and exploit?
<zid> nuance, nothing big
<shikhin> What is that nuance?
<heat_> exploit takes advantage of the vulnerability
<nikolapdp> vulnerability is a potential exploit in the future
<zid> vulnerability is the class
<heat_> like, a vulnerability is something that *can* be exploited
<zid> It can also apply to say, MMO bosses
heat has quit [Read error: Connection reset by peer]
<heat_> anyway
<heat_> <heat> anyway the ELF string zero termination talk reminded me that I need to check if the string table is zero terminated at the end
<heat_> <heat> not that this is very serious because... you can just load a normal kernel module with that syscall
<heat_> <heat> if not, you can pass a crafted ELF file with a string that just runs off the end of the string table
m3a has joined #osdev
<nikolapdp> oh no
<nikolapdp> lol
<heat_> if my kernel had any sort of lockdown, this could be a problem
<zid> how does a non-terminated string help?
<heat_> help what?
<zid> how does it help me steal ur RIP
<zid> when I am not root
<heat_> you /probably/ can't steal anything, but you could cause it to crash
<heat_> and yes, when you're root and there's no kernel lockdown, this isn't *really* a problem, more like a quality-of-implementation issue
<zid> how? the length of the string isn't recorded anywhere else, so there's no buffer overflow or anything, the strcpy just goes a bit funny cus the 00 ends up being from .data or whatever's after the string table
<heat_> the string table is not near .data
<zid> string table at end of file, crash?
<zid> cus not mapped?
<heat_> usually you just malloc a big chunk and copy it in
<heat_> like, totally depends on your ELF loading strategy there
<heat_> you *could* hit some other random code and read garbage, you *could* crash
<heat_> s/code/data/
<zid> I'm asking about your code.
<zid> It's your bug
<heat_> depends on how you craft the ELF
<zid> Why is this a problem? Someone putting the string table at the end can cause a page fault?
thenerd has joined #osdev
<heat_> yeah
<zid> Okay then yea, that's bad, time for some accessors!
<zid> You'rea C++ weenie you can probably hack that up to work straight on [] right
<zid> without needing a BYTE_AT() function like I always write
<heat_> actually in my case you don't even need to care about the file layout, i just malloc(sizeofsection) and read it in
<zid> Mine doesn't read sections
<zid> cus it's an elf loader not a debugger
<heat_> yes but this is a module loader
<zid> dynamic linker
<heat_> no, modules for the kernel
<zid> yes, dynamic linker
<pogspawn> not exactly
<heat_> and the traditional way of doing it is not with shared (dynamic) objects, but just a .o
<zid> is it dynamic? yes. Is it linking? y es.
<zid> Dynamic linker.
<heat_> anyway the fix is just to check for \0 at the end, anything else is a malformed string table
Neo has quit [Ping timeout: 260 seconds]
<pogspawn> me too
<zid> Yea that's one way of doing it for sure
<heat_> i don't /really/ use modules anyway
<zid> feels like a hack but it's definitely just the simplest and fastest
<zid> I hate code like that :(
<zid> Where the best way to do it is ugly
<zid> The 'correct' feeling way to do it is to vet accesses so you don't do OOB reads, but your method is faster and less code
<heat_> yeah
<zid> /* We're only scanning linearly, and only if we don't see a 00, so we can just check if the final byte is 00 to prevent all overruns */
<heat_> all of that code is pretty much converted C -> C++ anyway, no fancy tricks going on