#Nyaux
1 messages · Page 52 of 1
Nyaux needs to overthrow the oppressive MOGA government

nyaux gamin
why
so everything has to succeed :clueless:
no failures in nyauxland
yes
waitpid is clearly to blame for this but waitpid is doing everything correctly
task succeeded failfully
if i cant figure this out ill ask for help for both issues
when nyaux minecraft
i need help with these 2 issues first, if i solve them (or someone else points out the issue for me to fix) and i manage to port nano and doomgeneric maybe
obviously a minecraft server
not a minecraft client
what is 2 issues
ncurses not happy causing nano to not work and bash not getting return code anymore
still cannot figure this out
help 
nano might/probably needs quite a few more TTY things to work i think?
no not really, its ncurses failing

and waitpid isnt working again
am too stoopid to be good at helping 
is oki dw
@molten grotto do u think you can help with this 
maybe tomorrow, I need to go sleep
hiii did u have a good sleep
yes
thats good
are u free to have a look later?
in relation to why bash isnt getting the return code and why nano gives out an error saying error opening terminal, more information on the ncurses issue is that it gave an error in nc_new_term()
ive been stuck
for a while in these 2 issues
Ill take a look
you write the error code to the user supplied status argument inside the kernel when you should be returning it in the syscall result's .ret
no? waitpid expects pid as .ret
actually nvm ignore that lol
all good lol
yeah I just realized
the loop inside waitpid seems kinda weird tho, like if there are eg. two died processes and you do waitpid you set the processes state to BLOCKED so then the second call to waitpid will fail if there would be a process after that (and the end check should probably be us == cpu->process_list if its a typical circular list where the last one points to the first and not to itself
also waitpid is supposed to block if there are no exited childs with 0 flags
its not a circular list
im not blocking
atm
but that shouldnt be an issue
plus i cant block anyway
in a syscall
why
non preemptable syscall remember
well at some point you do want at least allow them to block (which isn't that hard tbh, like I think the only thing that there is possibly preventing it is the per cpu syscall user sp which you could save to a field inside the thread at the start of the syscall and restore at the end (and then use the copy saved inside the thread in eg. the fork code)
kinda would be
but dont quote me on that my brain isnt braining atm
@molten grotto anything yet?
guessing not
looks like ill have to do more debugging myself
yeah I didn't really find anything other than like the exit status is returned fine from mlibc and after that it does an another waitpid which returns ECHILD (which might be where it gets the zero from because the code checks for that and breaks the waitpid loop with status set to 0)
can u show me which line of code in bash?
what am i supposed to return to make it happy
?
@molten grotto
reading the code doesnt make sense to me a lot
im not used to gnu code
i dont see where it sets the status to 0?
in the first link it returns -1 and in the second one WSTATUS (child->status) = 0; (I think that's where it would happen anyway)
so what exactly do i do
I am not completely sure, other than like implement it properly lol
after setting the stauts
what should i do

im not implementing preemptable syscalls atm
What are you trying to do?
What's the issue there
Yeah idk I never got this far
lmao
Best I did was doom
crazy
Very
well that line is never even included as its inside #if 0
you have to first comment out the if
also there are some memory leaks somewhere, trying to run nano multiple times causes an oom
ik
thats to be expected
but nano error opening terminal is not fun

@molten grotto
added a debug statement
printing anything causes an infinite loop with waitpid

yea i have no idea how to solve this
How does your waitpid work
What does bash get back
^ @kind root
i cant trace much or it gets into an infinite loop
if i mess with the source too much
clearly giving the error code
Ate you sure it's supposed to return echild if the child blocks
i really dont know
Did you read the docs for it
yes
What do they say
Why do u return echild at all?
Well then implement waitpid so that it actually finishes the wait properly lol
When the child dies
Only if there are no children
as in block?

No
then what
Just spin until all children die
good idea
yeaaaaa
i need to implement preemptable syscalls
this shit not working

no wait
it is executing shit?
so why tf
is it not returning
oh right syscall user rsp thats never saved properly
shit
how exactly would this work, sorry brain not braining
i need to implement this now
I'm simply reacting to his post.
Sorry it's such an issue for you.
I think you're the only one here who understands how they are connected
I'm not doing this just because, I'm doing this because I got complaints
what part of it
like you copy the tmp user sp from the cpu struct to a field in the current thread struct either in the syscall asm or inside a specific syscall that you know will yield or whatever and then either in the syscall asm or at the end of that syscall before returning store the value you stored inside the thread struct to the syscall sp tmp field inside the cpu struct
why store at the end of a syscall?
so the proper value can be loaded back to rsp by the syscall asm
void my_syscall() {
cur_thread()->syscall_user_sp = cur_cpu()->syscall_user_tmp;
// yield or whatever, cur_cpu()->syscall_user_tmp can change
// store the value saved inside the thread to inside the cpu so it can be used by the syscall asm restoring the user sp
cur_cpu()->syscall_user_tmp = cur_thread()->syscall_user_sp;
}
what about the syscall frame
if you are talking about the usage of it by fork then it doesn't really matter unless you make syscalls unvoluntary preemptable (interrupted by the timer switching to some other thread)
i mean in general
what about it
wont i lose it
why would you lose it, the threads don't use the same syscall stack hopefully
wdym
kernel stack is loaded from thread
so why would you lose it then
idk ur right
struct __syscall_ret syscall_waitpid(int pid, int *status, int flags) {
struct per_cpu_data *cpu = arch_get_per_cpu_data();
sprintf("syscall_waitpid(): wait on pid %d, flags %d\r\n", pid, flags);
if (pid != -1) {
return (struct __syscall_ret){.ret = -1, .errno = ENOSYS};
}
neverstop:
cpu->cur_thread->syscall_user_sp = cpu->arch_data.syscall_stack_ptr_tmp;
struct process_t *us = cpu->process_list;
while (us != NULL) {
if (us->state == ZOMBIE) {
sprintf("doing so with error code %lu\r\n", us->exit_code);
*status = W_EXITCODE(us->exit_code, 0);
us->cnt = 0;
us->state = BLOCKED;
return (struct __syscall_ret){.ret = us->pid, .errno = 0};
}
if (us->next == us) {
break;
}
us = us->next;
}
// TODO: fix syscall to save user rsp
sched_yield();
cpu->arch_data.syscall_stack_ptr_tmp = cpu->cur_thread->syscall_user_sp;
goto neverstop;
}
doing this causes infinite page fault

only thing that fixes it is moving cpu past the label
and it just hangs instead then after giving the error code
idk whats going on 
i slept for too long

looks fine intially
bro
why is it ab8 now????
wtf
@molten grotto how did i fuck this up so bad 
tf is going on
yea sched_yield() is fucking shit up
i dunno how but somehow
hmmm
I do the same shit
I also do the same
we should all play cs2 once
the osdev cs2 major team
Let’s do it
bru
no
what you have right now is pure insanity
you're probably just mangling some saved registers
i dont know where tho
if it gets to printf
it dies returning here
u said i only needed to save the syscall user ptr but even doing that im somehow corrupting the return pointer??
yeah idk the scheduling code is a huge mess
is syscall_ret larger than 16 bytes?
it is 16 bytes
us gets corrupted
if you look at assembly, it's probably going to be in the saved regs
how
what does it compile to?
us is valid
Where it dies?
It's in rbx
you're probably just mangling some saved registers
yea but i dont know what
shed_yield probably
rbx
what does disassembly of this look like?
like you're not saving/restoring them properly
yea but i dont know what im not saving/restoring properly

it returns to this spot instead
@flat nymph
RSP IS BEING DUCKED DOWN BY 10 AFTER EVERY SCHED YIELD @molten grotto @flat nymph
0x10?
yes
because if yes then I think it makes sense as you never return from schedd (so all the code after that in yield is unnecessary) and the rsp that you put to the irq frame points to what the rsp was after the first push rax
change lea rax, [rsp + 8] to lea rax, [rsp + 24] so it pushes the original rsp skipping the pushed rax + rip
ill try hold on
it solved the issue i think?
let me check
it works
thanks @molten grotto
new problem
bash is repeatably calling waitpid
even tho i return the return code
and it DOES return back to syscall entry
which returns to the libc
which returns to bash
bash calls it again
to which gets stuck in an infinite loop because obvious reasons
that sounds like it didn't get the pid it wanted to wait for or smth
idk
it just called again with -1
flags are 0 still
ig you can add some debug prints to the loop in bash (though it's likely very spammy if you print something in the general path)
okay
@molten grotto
maybe it wants ECHILD when there are no more child
okay hold on
ok atp i have to make the concept of a child an actual thing in my kernel
instead of some process list garbage
this behavior
or
this behavior
or no memory on the second fork() call
not fun
ive debugged for long enough im gonna go play subnautica below zero and tmrw look at it again
I played it for like 12 hours but then got bored
Even though the first game I couldn't stop playing until I beat it
yea i hear the second game is hella bad
idk why the made the pda voice sound different in the second game too
Have fun
Hopefully its good
hopefully
Sometimes it's always best to take a break, and come back it
yes
its broken atm
via wsl
heretic
What's wrong with wsl?
yea
where x86
Unfortunately there's a lot of stuff that doesn't work well/at all on Linux yet
building rn
dont
:3
ur gonna build the gcc toolchain
ty
i dont support keyboard ps2 yet
thats a whole can of worms to deal with later
after i have those 5 bugs in the kernel fixed evneutally
doomgeneric is installed but u cant run it since i have no /dev/fb0 device (YET)
i do have /dev/tty
so have fun with that
I added those now how do that?
edit: nvm figure out
erm
i cant
control C
it died and no longer accepts input
i meant restart the vm
ohh
waking up to debug some more ig
IVE MANAGED TO MAKE ONE OF THE ISSUES CONSISENT
THANK GOD
one of the issues is now consisent
still an issue but
its coonsisent now
that is good 
makes it easier to debug at least
yes
could be a race condition considering i rearranged the shit in waitpid
found the reason for the page fault in waitpid at least
one bug fixed
2 more to go

or 3
but we will get to the ncurses memes when we get there
it was a use after free the waitpid shit
now i triple fault only on kvm
wtf

@molten grotto how tf do i debug a triple fault on only kvm wtf
kvm tracing
how
idk
lol
i didnt know how either
and i forgot
but it's somewhere in my bash history
i just ^R and type "trace" whenever i need it 
https://www.linux-kvm.org/page/Tracing (though you can usually install trace-cmd from whatever package manager)
i usually just poke at the /sys/kernel fs
how to delete all lines after the cursor in vscode again
i have a 500mb kvm log file now
i found the triple fault log but i need to make it cleaner cause wtf
qemu-system-x86-187072 [011] d.... 54378.570696: kvm_exit: vcpu 0 reason TRIPLE_FAULT rip 0x41614201 info1 0x0000000000000000 info2 0x0000000000000000 intr_info 0x000000f6 error_code 0x00000000
i don't think you can do that?
okay
you can select from cursor to the end manually
qemu-system-x86-187072 [011] d.... 54378.570690: kvm_exit: vcpu 0 reason INTERRUPT_WINDOW rip 0x41614201 info1 0x0000000000000000 info2 0x0000000000000000 intr_info 0x000000f6 error_code 0x00000000
qemu-system-x86-187072 [011] ..... 54378.570691: kvm_inj_virq: irq 32
qemu-system-x86-187072 [011] d.... 54378.570692: kvm_entry: vcpu 0, rip 0x41614201
qemu-system-x86-187072 [011] d.... 54378.570696: kvm_exit: vcpu 0 reason TRIPLE_FAULT rip 0x41614201 info1 0x0000000000000000 info2 0x0000000000000000 intr_info 0x000000f6 error_code 0x00000000
dont worry my log files (multiple) we also in the couple hundred MB range when i was doing VMX on managarm
thats all it gave me
it should have stuff before it
theres nothing before
you don't just triple fault
there has to be a double fault before that
and before that something else
oh, no, you won't find it like that

i have never done that
kvm was helpful enough to produce very easy to search entries for what i needed
(entry failure)
it's probably not that in your case
yea theres nothing about exceptions in the log file
other then triple fault
im fucked
what about the exception irq numbers
yea ur not finding that
I mean it would probably be somewhere close to the triple fault line
wait ept violation
no its not
ept violations can be normal for like mmio and whatever
yea nothing other then ept violations for mmio
cant find anything related to why it triple faults

yea so what tf do i do....
when does it fault
somewhere in userspace
just when you try to boot into bash?
can you put the updated code to git
yea
its on git
without the log file ofc
that thing is 500mb
find anything yet @molten grotto ?
at some point the rsp that's stored in the tss's rsp0 is not properly mapped so then when you get an interrupt it can't push stuff to the stack
(and as for how I got the double fault to show I added an ist for it so it always has a valid stack to push stuff to)
when???
my bet is that it would be the reaper killing the thread that unmaps it but I haven't verified that
because like its not going to immediately show if its invalid, only after you get an interrupt in usermode
how doesnt every thread get a seperate rsp0
yeah they should
weird
yeah its freed from the reaper
wait I think I might know why, you only change rsp0 if the current thread's frame indicates that it came from usermode, what if you yielded in kernel mode inside a syscall, then the frame doesn't indicate usermode so you don't change rsp0 and then from the syscall you eventually return back to usermode still having not changed rsp0
remove the check
see if it fixes it
yes moving the rsp change line outside the if fixes it
the return code is still broken but at least it doesn't die anymore

thats with free pagemap COMMENTED out btw
new issue now
when uncommenting free pagemap
this shit happens on running nano again
@molten grotto gdb gave me no where about this
this is when free_pagemap is uncommented out
im unsure whats going on

gotcha
im printiung every free
theres no 0x2
so why is head.next becoming 0x2
?????
try setting a watchpoint in gdb
at 0x2?
at head.next
okay
watchpoints highlight the line after the one that triggered it, usually
id just continue walking through watchpoints until the new value is 2
unless the address causing the fault is inconsistent?
oh that's incredibly annoying to debug
i believe there are some qemu flags that make it 100% deterministic which might help
don't remember what they are though

there's also the record/replay stuff but i've never used that so idk how well it works
smells like UAF.
uaf?
use after free
so the thing with this type of bug is that the bug may be in component X, but its symptoms appear in component Y.
I love UB
arch destroy pagemap is the issue
dont know why tho
static void destroy_page_table(uint64_t *table, int level) {
uint64_t *vtable =
(uint64_t *)((uint64_t)table + hhdm_request.response->offset);
for (int i = 0; i < 256; i++) {
if (vtable[i] & PRESENT) {
if (level < 3 && !(vtable[i] & PAGE2MB)) {
uint64_t *next_table =
(uint64_t *)(((uint64_t)(pte_to_phys(vtable[i]))));
destroy_page_table(next_table, level + 1);
}
}
}
pmm_dealloc((void *)((uint64_t)pte_to_phys((uint64_t)table) +
hhdm_request.response->offset));
}
doing vtable[0] solved it interestingly?
whick kinda makes sense
it still ooms tho after u try to execute nano
so memory leaks somewhere
why tf is nano mmmaping have the memory on the vm tf
and why arent my pagetables getting properly deallocated?
Just leak every page table like BadgerOS does 
I know I'm late but I think you could do [Shift+Ctrl+End], [Delete]
should it be zero on entry?
No, like how do you create threads?
void create_kthread(uint64_t entry, struct process_t *proc, uint64_t tid) {
struct per_cpu_data *cpu = arch_get_per_cpu_data();
struct thread_t *newthread = create_thread();
newthread->proc = proc;
newthread->tid = tid;
refcount_inc(&proc->cnt);
uint64_t kstack = (uint64_t)(kmalloc(KSTACKSIZE) + KSTACKSIZE);
struct StackFrame hh = arch_create_frame(false, entry, kstack - 8);
newthread->kernel_stack_base = kstack;
newthread->kernel_stack_ptr = kstack;
newthread->arch_data.frame = hh;
refcount_inc(&newthread->count);
refcount_inc(&newthread->count);
ThreadReady(newthread);
}
how i create kernel threads
ideally you should, that would let the debugger know where the stack trace ends
rbp is zero?
???????????????????
@flat nymph
wtf is going on
static void destroy_page_table(uint64_t *table, int level) {
// we are already in a differnt page table so this should be fine
uint64_t *vtable =
(uint64_t *)((uint64_t)table + hhdm_request.response->offset);
for (int i = 0; i < 256; i++) {
if (vtable[i] & PRESENT) {
if (level < 3 && !(vtable[i] & PAGE2MB)) {
uint64_t *next_table =
(uint64_t *)(((uint64_t)(pte_to_phys(vtable[i]))));
destroy_page_table(next_table, level + 1);
}
}
}
pmm_dealloc((void *)((uint64_t)pte_to_phys((vtable[0]) +
hhdm_request.response->offset)));
}
this function is kinda corrupting my stack huh??
the top 256 is for the hhdm which i copy
these are all the kernel page tables
which i copy
and i dont get rid of ever
256-512
you mean 256-511?
yes
but then you call this function recursively
and it still only frees 256 out of 512 entries
which are now all userspace
okay good point
static void destroy_page_table(uint64_t *table, int level) {
// we are already in a differnt page table so this should be fine
uint64_t *vtable =
(uint64_t *)((uint64_t)table + hhdm_request.response->offset);
if (level != 0) {
for (int i = 0; i < 512; i++) {
if (vtable[i] & PRESENT) {
if (level < 3 && !(vtable[i] & PAGE2MB)) {
uint64_t *next_table =
(uint64_t *)(((uint64_t)(pte_to_phys(vtable[i]))));
destroy_page_table(next_table, level + 1);
pmm_dealloc(vtable);
}
}
}
} else {
for (int i = 0; i < 256; i++) {
if (vtable[i] & PRESENT) {
if (level < 3 && !(vtable[i] & PAGE2MB)) {
uint64_t *next_table =
(uint64_t *)(((uint64_t)(pte_to_phys(vtable[i]))));
destroy_page_table(next_table, level + 1);
pmm_dealloc(vtable);
}
}
}
}
pmm_dealloc(
(void *)(pte_to_phys((uint64_t)table) + hhdm_request.response->offset));
}
still fucking ides
man that is fun
what the function looks like currently
still stuck 
🥺 🫂
been debugging i still dont understand whats wrong exactly
this is so fucking weird
is there anything inheritably wrong with this function @molten grotto ? this somehow corrupts my stack and causes weird shit
commenting the function out removes all broken behaviorf
so its def osmethinw with this function
??
you free vtable multiple times
also you use it after freeing it
yea
you do it inside the loop
did you remove it from both of the loops
idfk how it manages to corrupt the pmm even
cant even watch *0x2
wtf
yea no idea whats going on
even wrote a scan for garabge function after destroying page tables to check for 0x2
it found nothing @molten grotto
all im thinking about is probs memory corruption of some form
only thing left to try is gdb pt dump
other then that out of ideas lol
before destroy page tables
page tables after destroying it
yea they look normal idfk whats going on

commenting this out doesnt cause much issues
last resort
gonna try this
all the addresses
yea i need help 
you free take->root twice
at the end of destroy_page_table and in x86_64_destroy_pagemap
that solved it?
wtf
im still running out of memory tho

so some memory leakage
i think i know why @molten grotto , its because i only free the deepest entry in a page table. is this correct? or wrong?
wait no thats wrong
yea i dont know where im leaking memory now
you never actually free the mapped pages
actually wait
i pmm dealloc them
yea i dont know whats going on either lol 😭
bug after bug qwinci
we arent getting a break
you do slabfree on the vmm region structs but I don't see you freeing the pages
because we destroy the page table no? shouldnt that nuke all allocations on the vmm regions anyway?
how so
because level is 0 for pml4, 1 for pdp, 2 for pd, 3 for p
I think what would work is removing the level checks from the inner if's and just special casing level 4 to only to pmm_dealloc
it solved the memory leasks
leaks*\
but why
static void destroy_page_table(uint64_t *table, int level) {
// we are already in a differnt page table so this should be fine
uint64_t *vtable =
(uint64_t *)((uint64_t)table + hhdm_request.response->offset);
if (level == 4) {
goto bro;
}
if (level != 0) {
for (int i = 0; i < 512; i++) {
if (vtable[i] & PRESENT) {
if (!(vtable[i] & PAGE2MB)) {
uint64_t *next_table =
(uint64_t *)(((uint64_t)(pte_to_phys(vtable[i]))));
destroy_page_table(next_table, level + 1);
}
}
}
} else {
for (int i = 0; i < 256; i++) {
if (vtable[i] & PRESENT) {
if (!(vtable[i] & PAGE2MB)) {
uint64_t *next_table =
(uint64_t *)(((uint64_t)(pte_to_phys(vtable[i]))));
destroy_page_table(next_table, level + 1);
}
}
}
}
bro:
pmm_dealloc(
(void *)(pte_to_phys((uint64_t)table) + hhdm_request.response->offset));
}
why does 4 work
level 0 entries point to pdp (level1) tables, level 1 point to pd (level 2) tables, level 2 point to p (level 3) tables and the entries in level 3 are the page addresses itself (so level will be 4 for those)
makes sense
thank you SO MUCH qwinci
liuke actually
so many bugs are fixed lets fucking go
now i can debug ncurses!
dont u love ncurses too qwinic
@molten grotto ?
idk lol
lmao
need to figure out why bash isnt happy with waitpid
unconditally returning 3 causes bash to accept the return code
??????????????????
that makes sense
🤦

why do people ignore me all the time? 
im going to cry in a corner :c
ncurses hates me and i hate ncurses
also i have no fucking idea how fbdev works yet i made the device file for doom
which isnt happy cause no keyboard0
could it be normal that it allocated a bunch of memory and doesn't use it in the end?
/dev/keyboard0
i dont know
i really dont, it allocate huges amounts of memory
and if i gave the vm the memory it need
needs*
it just page faults eventually
so like
:(
at least we have working bash error codes
like just error on mmap and see what happens
i cant just error on mmap for everything
when you run out of memory
ill just error out if it tries to allocate an abirtury size
like idk
a gigabyte
this check isnt working for some reason

wait nvm
hold on
@flat nymph yea i cannot tell it to fuck off

I think this is mlibc memes
can you make it print stack traces on panics?
i mean sure but ur not getting any symbols
you can just addr2line
What's the problem with it?
its all loaded dynamically
im just gonna implement demend paging
cause im SICK of userspace programs asking for gigabytes of ram
sir u dont need that much ram
it may fix some weirdo issues with nano
anyway since i KNOW the nano devs assumes its all gonna be demend paged anyway
The fact any of these programs are questing such a size is nuts.
thats userspace for you
letsgoo
progress on nano after adding demend paging
seems like free is doing a lot of shit
causes it to be HELLA slow
Well.... at least for now it's something till you're able to get something else working
no now i have new issues
Oh jeez..
its open buffer in nano now
Certanily some progress!
bool has_valid_path(const char *filename)
its infinitely allocating in here
it is realpath()
The Variable named fein is golden
How do you even use Jinx anyways? I didn't even really see instructions for it.
LETS FUCKING GO BROOOO
no input working atm but tbf to be expected considering i dont rlly implement tty very well lol
idk how nano reads its input
read() ioctl() and tcgetattr() and tcsetattr()
weirdly its not accepting my serial input
eh its fine ill debug that later
im tire
tired
we got nano working lets fucking go
Nah bro you got nano working good job
You’re the fucking goat
Good night bro I hope you sleep well
Proud of you
thanks bro
if i can get nano fully working next up will be getting fbdev working for doom
Shittt that’s awesome
I couldn’t tell you why
Your read() syscall should handle that
no read works fine with bash
Oh damn
its just nano isnt happy
No clue then
its fine ill debug it later
?
Does your read() only work in line buffered mode?
line buffered mode?
whats that
i have a ringbuffer in the tty
i pop off one char and give it on read
Do you know what canonical vs canonical mode means
This helped me a lot to understand it: https://stackoverflow.com/questions/358342/canonical-vs-non-canonical-terminal-input
Basically bash recieves input line by line, but nano needs input for each character
It’s some
Bullshit i just remember running into it when I ported vim to an old kernel I made
There was some paper I found about it
Let me try to find it
okay
me after updating mlibc and getting this shit 
Rip
Didn’t you alr implement sys_getuid?
no
Well that makes sense then lol
Gdb that I guess
i tried
Well
nothing really
No trace back to anything?
nope
That’s cursed
I would recommend trying to see what mlibc updated
Like see exactly what changed
And then go from there
Because if you can’t get a trace back then you have to work backwards
yea i have NO idea
I would recommend looking at the changes mlibc added
i did
And what was the thing it changed
Probably in the new includes or something
Did you try looking for the exact sys functions it needs that it’s saying it’s a stub in your error
k
this isnt even valid assembly according to gdb
its jumping to fucking nowhereland
bro
i have no idea
whats going on
its nearly 5am
i cannot
im gonna make mlibc log everything cause
yea
didnt change garbage
it just hangs after sys_getegid is a stub for like 2 seconds
then dies
same issue
yea i need help
I would try but you can’t even track down rip
yea no fucking clue
Honestly just
i love when bugs randomly appear as soon as i solve them
™️
damn
well im going sleep, ill ask dennis or whoever when i wake up if they changed anything with the rtld or smt
maybe they can help\
Alright bro good night. Sorry I couldn’t help more but this is just cursed lol
im lost

its failing in bash somewhere idfk its being really annoying to debug
im so fucking lost
still stuck

@molten grotto did they change anything recently in mlibc?
that couldve caused this
what instruction is faulting there?
could be something like not enabling sse
since it's an illegal instruction exception with what looks like a sane address
its very inconsisent
and no it sometimes jumps somewhere completely NOT sane
idk how this would be an issue after updating mlibc
sse is enabled ofc
i cant find the address either way
its so inconsisnet
@brisk zenith itsfucking garbage
yeah nvm then
do you have anything in rbp?
(and do you have stack frames enabled?)
whats the flag again
-fno-omit-frame-pointer iirc
thats enabled for userspace
and mlibc?
yes its enabled
if it is, something is really messed up
could you be jumping there from kernel?
I'm guessing the actual incorrect jump happened earlier, but the data there happened to be valid machine code that zeroes the stack before eventually faulting
like if you corrupt stack
case "$ARCHITECTURE" in
x86_64)
TARGET_CFLAGS="$TARGET_CFLAGS -march=x86-64 -mtune=generic -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g"
TARGET_CXXFLAGS="$TARGET_CXXFLAGS -march=x86-64 -mtune=generic -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-z,pack-relative-relocs"
;;
esac
thats the full compile options
i dont know
how its even getting here
seems frmo userspace
what mlibc commit are you on?
does it get to the same address?
latest
like maybe you're getting there in ring 0
(idk)
like does the kernel distinguish user vs kernel faults?
not a valid commit hash 
also we are in userspace
what is the state of the other registers?
could kernel be saving/restoring registers incorrectly?
not really
it was working before
™️
like i don't even know what to suggest
theres some more things on the stack ™️
you could play with watch points
i would look at the kernel though 
i mean its obviously something wrong with my kernel
but i dont know what
i dont even know where to begin on debugging this

updated my bootloader to latest mlibc and bash works fine, so i don't think it's that
obviously wouldnt be that
afterall its always my kernel ™️
theres this one address on the stack
just add printfs on all interrupts and faults (and syscall) to see if there's a pattern
looks promising but idk
i lit do on all syscalls
idfk wheres its dying
what about timer interrupt
why would i print the timer
maybe you're corrupting it there
is the instruction right before what's shown here a call?
if i was i wouldnt be executing userspace code
your kernel doesn't move executables, right?
it does
wtf why is there a (bad) in the middle of what otherwise looks like completely valid code
no fucking idea
I think this is probably memory corruption
just letting you know i demend page all mmaps
i can disable that to see if that changes anything
But wtf is 0xe6683 and so on
no fucking idea
bash seems to work just fine for me after a rebuild
i disabled demend paging for mmap
huh??
what commit
didnt change shit
what did u do
the latest one where the bash from the old commit is broken
oh is it just an abi break?
you mean the commit "help"
yes
idfk
I tried to look through mlibc history and I didn't really see anything that would be an issue though so idk
can u rm jinx cache and try
ill do the same
try doing it for readline too
i did it for all of them now
ncurses I couldn't get to compile on the new version, it says that configure: error: Shared libraries are not supported in this version
oh that's what happens if the one ncurses patch is missing
which is?
ah yeah you deleted the patch
fuck
also you deleted the bash patch too
yea lemme steal one from vinix holdon
you could just restore it from the old commit
or wget https://raw.githubusercontent.com/rayanmargham/NyauxKC/55fb1b4498610b69257849f00df529ca6ab275b2/patches/ncurses/jinx-working-patch.patch
?


