vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
MiningMarsh has joined #osdev
innegatives has joined #osdev
MiningMarsh has quit [Client Quit]
MiningMarsh has joined #osdev
<innegatives>
From what little I understand one of the main benefits of a language based OS is security based on language's types, does this mean TypeScript based OS essentially lacks this because TypeScript types are not enforced in runtime?
<innegatives>
Is it sensical to make small kernel with C++ and embed V8 on that and build rest of the OS in JS/TS?
<Mutabah>
That's what I'd do for a "JS" OS
<Mutabah>
Write a C/C++/Rust microkernel with an embedded interpreter, and do the rest in the other language
<innegatives>
But is there any benefit to JS OS compared to a strongly typed language OS?
<Mutabah>
IMO, not really... but I guess since it's a dynamic language you get the ability to introspect state easily
<innegatives>
Would it be possible to do something like hack TS to enforce types at runtime?
<Mutabah>
And I guess it makes it easier to port between architectures
<zid>
It's not based on the language's types, moreso the ability of the language to construct and run code
<Mutabah>
Don't think so. Afaik TS is just a translation layer to JS
<zid>
so as long as you ban eval, and there are no implementation bugs, it's not *possible* to hijack the control flow of javascript from within javascript
<zid>
can't corrupt rip if nothing lets you write to it
<innegatives>
But same can be said of C, yet here we are
<zid>
Cannot be said of C
<zid>
C allows you to construct and run code
<zid>
you *cannot* ban eval
[itchyjunk] has quit [Ping timeout: 246 seconds]
<innegatives>
Who are you banning eval from? Userspace app developer?
<zid>
the language
<zid>
remove it
<Mutabah>
Remove `eval` from the interpreter, and now RCE isn't possible at all (unless the very interpreter has a bug)
<zid>
The attack surface on javascript is "letting the attacker eval something they should not have" (or an impl. bug, like accessing off the end of an array)
<zid>
It's very similar to a SQL attack in that regard
<innegatives>
If you can write and execute code, does it matter whether it happens through eval or without?
<zid>
The solution is 'only run prepared queries', aka, remove eval
<zid>
You cannot execute *kernel* code
zxrom_ has joined #osdev
<zid>
you said the kernel is written in js, so is my browser's UI, user programs cannot change my browser's UI because they just don't have the `document` reference for it
<zid>
your user programs would not have the kernel's DOM
<zid>
in C without memory management, I can bypass this with just *((int *)0xDEADCAFE) = 7; or whatever, no memory safety
<zid>
In javascript, there is *nothing* I can do
<zid>
unless I can trick the kernel into eval()ing something
<innegatives>
How having eval lets you have reference to kernel DOM?
zxrom has quit [Ping timeout: 246 seconds]
<zid>
The kernel has one
<zid>
the kernel is running the eval
<zid>
ergo 'document' in the context of the kernel, is the kernel's
<innegatives>
So of interface to kernel eval is secure and has no bugs it's safe?
<zid>
yes
<zid>
but then w're back to "just don't write buffer overflow exploits"
[itchyjunk] has joined #osdev
<zid>
(it may be marginally safer regardless though because it's easier not to write eval bugs, maybe)
<innegatives>
ok, makes sense
<zid>
Consider a very feature sparse interpreted language where all you have is GOTO 10, there's obviously 0 attack surface there, I can't corrupt memory, can't corrupt state, etc, there's just no primitive to do so
<zid>
C has *every* primitive available to it, JS has 'eval'
<zid>
Because C has *every* primitive available, in order for it not to be *able* to shit on other things, you have to *physically* stop it being able to, not just pray that it doesn't
<zid>
that's called memory protection
<zid>
if there's no address I can write to to write to kernel memory, I can't write to kernel memory no matter what C program I write
<Mutabah>
I think it's a system board, I recall some motherboard designs at one point being just a backplane - with the CPU being on a special ISA card?
<Mutabah>
Although... looks like it has a DE-15/DE-9 sized connector
<jimbzy>
No idea.
<Mutabah>
oogle the markings along the top of the board?
<Mutabah>
It seems to say "PUMA 386 CV MODULE REV 0"
<Mutabah>
Maybe early dedicated hardware for computer-vision?
innegatives has joined #osdev
<jimbzy>
Could be
<jimbzy>
I wonder if it was part of a CV gate.
<Mutabah>
more likely
<innegatives>
my dumb ass just cloned Phil's Rust blog OS and tried to cargo add boa, but that obviously doesn't work because shit's not no_std
<zid>
tseng made graphics cards if that helps
<zid>
that's also a din connector, might be cga/vga/etc
<innegatives>
Do I need to write my own no_std JS interpreter if I want to do bare metal Rust JS OS?
<innegatives>
Mutabah: I imagine same is true for V8 and other C/C++ based interpreters? You would expect them all to require the stdlib right?
<zid>
picture of a similar huge ass tesng card
<zid>
but with a big TI chip
<jimbzy>
ET4000AX
<zid>
nod
<zid>
That's one of their regular gpus, 1MB of memory!
<jimbzy>
Interesting.
<Mutabah>
innegatives: very very likely
<zid>
viper fx?
<zid>
hmm not finding anything decent
<innegatives>
then gang is going to try to write no_std js interpreter next, surely going to succeed given my track record
<CompanionCube>
are those two other CPU sockets? unlikely, surely?
<zid>
a 386dx was a 387 + 386 afaik?
<zid>
might be for an actual 386 + 387 setup if they couldn't get a dx
<zid>
(afaik a 387 works super weird and snoops the memory bus of a running 386 to see if a 387 instruction is being fetched and then injects the results where it 'should' be or something totally insane)
<zid>
actually maybe it's for a 286 or 486 and the pinout is different? I need a 'pinout of shit cpus' detective
<jimbzy>
16-bit card?
<zid>
you'd very hope so
<zid>
it being an 8bit card would surely be a waste, that thing must have cost thousands
<jimbzy>
ET4k is 16-bit.
<zid>
and you know, all the pins are there *points*
<zid>
tsenga probably just sold them the chip so this.. whatever it is, could have an output
<zid>
I think the main 'point' of it is that it's a powerful *something* on an isa card
<jimbzy>
Pretty funky.
<zid>
like maybe it's actually a vga capture card or something
<jimbzy>
I hope I grow up to be as smart as you. ;)
<zid>
why are we being snarky? :(
<jimbzy>
I'm not.
<Mutabah>
zid: I don't think they are
<Mutabah>
Although... I'd call that experience, not smarts :)
<zid>
you added the patronizing emoji to the end of it!
<jimbzy>
Well, that's because I'm 40 :P
<zid>
ahh so it was a joke, just at you, and I needed bg knowledge I didn't have to parse it
<jimbzy>
Yeah, that's what I thought of when I first saw it.
<zid>
I think it might just be an inboard with integrated vga
<zid>
Back in the day, the IRS depreciation period for computers was super long because it was designed for mainframes. PCs had a very short lifetime due to Moore's Law which was still quite in force. PCs were so expensive they were considered capital equipment and could not be replaced until depreciated, but they could get budget to upgrade them.
<sham1>
mcrod: so… why *don't* you use dynamic dispatch
<mcrod>
I'm curious
<mcrod>
dynamic dispatch is probably the right answer here
<sham1>
Anyway, the type you're looking for the type is Base<Derived>*
<mcrod>
but the problem is
<mcrod>
if I have multiple structs/classes derived from Base
<mcrod>
I can't do Base* ptr = whatever_the_fuck_I_want;
<sham1>
You can't just have Base, because it's a template
<mcrod>
understandably, I get it, it's a template
<mcrod>
hm I guess I'm asking for too much
<vdamewood>
What are you asking for that you wouldn't get with dynamic dispatch?
<sham1>
He probably doesn't want to have a vtable and whatnot
<sham1>
So he does static dispatch with curiously recurring template variables and such to avoid it
<mcrod>
there you go
<sham1>
But yeah. Bare `Base` isn't a type. You need a type parameter
<mcrod>
this is also experimentation
<sham1>
I suppose there is a way, if you want to get really hacky and use type erasure, but at that point it's probably just easier to use dynamic dispatch
smko has joined #osdev
<mcrod>
i just don't know how good compilers are at devirtualizing
<mcrod>
and yeah, probably
<sham1>
You'd most likely need one layer of pointer indirection either way, so I'd say that it's better to use the actual language feature as opposed to try and fight the language
goliath has quit [Quit: SIGSEGV]
<mcrod>
right, my next step was going to be along those lines anyway
<mcrod>
so yeah, ok
<sham1>
(I'm looking at you, -fno-exceptions crowd)
<mcrod>
hey I do that
<sham1>
For kernel code? Sure, but even in the context of osdev because I'm a believer in the Church of the Microkernel, I try to get as far from kernel code as possible, as fast as possible
<sham1>
And for user code, exceptions
carbonfiber has joined #osdev
<immibis>
mcrod: every Base<T1> and Base<T2> are different types and this is unavoidable because they have different functions that do different things.
<immibis>
you have basically two options. Either the code in main needs to know that it's a Base<Derived>* instead of just Base* - this can mean that more of your code uses templates
<immibis>
OR, you make them do the same thing, where that thing is "find out which thing to do and do it", which is dynamic dispatch
<immibis>
if you hate this dilemma, you might also consider (not to say it's always a good fit) using a tagged union instead of inheritance
<immibis>
you can have a limited dynamic dispatch, like `if(this->type == TYPE_DERIVED1) doDerived1Thing(); else doDerived2Thing();`
<immibis>
fundamentally if you want one code path that diverges instead of two code paths you need some point at which it diverges, which is dynamic dispatch
<zid>
which is just, kind of, always the question
<zid>
do you do if(p->a) blah; else blah; or do you do if(p->a) blah(); else blah2();
<zid>
one function with ifs() inside it, or an if() guarding two versions of the function
<immibis>
what
<immibis>
yes, the second thing is the question
<zid>
I was saying this is basically what programming is, determining when the best point to branch is
<immibis>
creating two slightly different variants of the code is expensive too - no matter whether you do it manually or with templates - due to caching
<zid>
because yea, you have to weigh a lot of stuff, duplication in .text vs potentially fewer cmps, etc
<immibis>
it isn't worth bloating your binary code to 200MB just to avoid some if statements
<zid>
that's the sort of thing the optimizer isn't going to do for you, it's just an educated guess you have to make
<immibis>
C++ code bloat is terrible when you start using templates for *everything*
<immibis>
sometimes templates can allow the optimizer to collapse a whole bunch of abstract code into the few statements that you actually need and then it's a good use of templates; other times they can't
<immibis>
like if you iterate over a std::vector<int>, because you have code that is specifically adding 4 bytes each iteration there is a very good chance the optimizer can turn it into a simple for loop and now you have both the abstraction and the performance. If you had a dynamic-sized vector with an `int m_elementSize;` it might not be able to do that.
dude12312414 has joined #osdev
Stary has quit [Server closed connection]
Stary has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
frkazoid333 has quit [Ping timeout: 246 seconds]
<gog>
:'(
foudfou has quit [Remote host closed the connection]
<heat>
clang-format sux, use microsoft word's auto formatting
<gog>
i fixed the thing that was making me sad
<heat>
poggers
<gog>
but my boss had to help because i couldn't reproduce the error
<heat>
fixing the thing that was making you sad is like, very poggers
<heat>
lads we've defeated depression
<gog>
i have some experience fixing the things that are making me sad
<zid>
I punch them
dude12312414 has quit [Remote host closed the connection]
frkazoid333 has quit [Ping timeout: 246 seconds]
xenos1984 has quit [Ping timeout: 240 seconds]
xenos1984 has joined #osdev
<zid>
keep ya fuckin covid, if I got any more brain fog I'd forget to breathe
smko has joined #osdev
<gog>
meow
<sham1>
nyah
<gog>
^w^
Left_Turn has joined #osdev
goliath has joined #osdev
innegatives has joined #osdev
Turn_Left has joined #osdev
goliath has quit [Ping timeout: 260 seconds]
Left_Turn has quit [Ping timeout: 260 seconds]
smko has quit [Ping timeout: 246 seconds]
gog has quit [Quit: Konversation terminated!]
zxrom has joined #osdev
xenos1984 has quit [Ping timeout: 246 seconds]
goliath has joined #osdev
smko has joined #osdev
xenos1984 has joined #osdev
slidercrank has joined #osdev
gog has joined #osdev
<heat>
we need to start false flagging newbie x86 questions
<heat>
to keep this shit alive and non-boring
* innegatives
wants to ask a newbie x86 question but too noob to think of anything
<innegatives>
you are glad i finished with that emulator tho, aren't you
<geist>
hmm, what do you mean by false flagging?
heat is now known as notheat
<notheat>
hello guyz i have problem in my kernal is rebooting help
notheat is now known as heat
<immibis>
no theat? but i wanted theat
<bnchs>
notheat: smack it hard
<bnchs>
and tell it to stop rebooting
<sham1>
Smack my kernel up
qubasa has joined #osdev
<bnchs>
if that fails
<bnchs>
beat the fuck out of it
<bnchs>
as a punishment
<bnchs>
so it'll learn to never reboot
<heat>
osdev challenges would also be really fun
<sham1>
But yeah, I don't see the value in trying to weed out x86 questions. Most if not all new OSDevvers target x86/AMD64, so we can just assume and ask
<zid>
heat: osdevcomp #1 when
<zid>
must make something that multiboots on x86 and solves a thing
<mcrod>
my neck is killing me.
<mcrod>
challenge: massage me someone
* sham1
massages mcrod
* mcrod
prr
<heat>
zid yeah and then it could evolve into some harder shit
<bnchs>
maybe your mother put up with you rebooting, but i don't
<heat>
like write a network stack that can correctly speak TCP or some shit
<zid>
You make the test harness
<zid>
and I will submit an entry
<heat>
no
<heat>
i complain, someone else writes it, you submit an entry
<zid>
every single powershell thing I've seen works like this
<zid>
you have to find the weird option you need on msdn
<mcrod>
shamwow
<sham1>
zid: Get-Help maybe
<sham1>
I can't test it, I'm not on Windows RN
<sham1>
I could have sworn that --help also worked
<sortie>
man foo
<sham1>
sortie: on powershell?
<sortie>
It does beat bat scripting
<sham1>
It certainly does. In some ways it's even better than UNIX shell
<sham1>
My biggest gripe is that the powershell window isn't a terminal emulator and I get all confused when I try to ^P and such and it just doesn't do what I expect
<sham1>
Also doesn't help that I'm more proficient in shell than in PowerShell
qubasa has quit [Ping timeout: 246 seconds]
<gog>
powershell is p cool
joe9 has joined #osdev
<sham1>
Executes commands and doesn't afraid of anything
eddof13 has joined #osdev
smko has joined #osdev
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
innegatives has quit [Quit: WeeChat 4.0.0]
<gog>
yes
danilogondolfo has quit [Quit: Leaving]
smko has quit [Quit: Lost terminal]
<heat>
gog
<heat>
hi
<sham1>
goggers
heat is now known as goggers
<goggers>
hello its me goggers
<sham1>
Faker!
<goggers>
league of legends moment
<sham1>
*insert that one famous part from "Invasion of the Body Snatchers"*
<gog>
hi goggers
<goggers>
hello im you but ers
<gog>
how's the living in iceland and being a programmer and all the other stuff you don't shut up about
<sham1>
I think you mean gers
<goggers>
brilliant
<goggers>
i love living in iceland and being a programmer and all the other stuff i dont shut up about
<sham1>
goggers: how do you feel about payment processors
<goggers>
geist: have you tried out the arm64 continuous bit in zircon or nah?
<goggers>
there's a linux patch set in the lkml that adds support for it in linux and you have like solid wins, but ofc it relies on higher-order buddy allocations
<geist>
i have not, but yeah would like to
<geist>
always meant to implement it for the kernel at least
<goggers>
i suspect it's very hard to see a difference if you can't really allocate contiguously
<sham1>
HONK
zxrom_ has joined #osdev
<goggers>
fun fact: atm my mmap allocation is O(n)
<goggers>
highly pessimal
<sham1>
It could be worse
<sham1>
It could be O(n!)
<zid>
pezzimul
<zid>
That's my new counting base
<sham1>
Compared to that it's outright optimal
<goggers>
O(PESSIMAL)
<zid>
it goes 1, 2, many, lots
<zid>
anything above 2 is too pessimal to care about
<goggers>
i think you need some sort of augmented rb tree (or similar) to do this right
zxrom has quit [Ping timeout: 250 seconds]
<sham1>
splay tree
<goggers>
like each node has a unsigned long gap_len;
<goggers>
and then you iterate manually thru the tree
<goggers>
radix trees would be interesting (I think FreeBSD uses em) for aligned allocation
<goggers>
linuks does an augmented rb tree for rmap functionality too (as to get an interval tree)
awita has quit [Remote host closed the connection]
<zid>
can you implement me one goggers
<goggers>
no
<goggers>
i dont program anymore
<goggers>
i play rocket league and csgo
<zid>
me either
<zid>
me too
<zid>
did you pay me my wages yet btw
<sham1>
Steam games with their own launchers should be hung