* 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]
<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?
<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>
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
<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_>
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>
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