Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some issues #263

Open
Vir-BryanQ opened this issue Oct 29, 2022 · 3 comments
Open

Some issues #263

Vir-BryanQ opened this issue Oct 29, 2022 · 3 comments

Comments

@Vir-BryanQ
Copy link

Vir-BryanQ commented Oct 29, 2022

  1. If try to run these code below:

                           #include <pthread.h>
                           #include <stdio.h>
    
                           void *func(void *arg)
                           {
                               while (1)
                               {
                                   printf("A");
                               }
                               return NULL;
                           }
    
                           int main(void)
                           {
                               pthread_t thread;
                               pthread_create(&thread, NULL, func, NULL);
                               while (1)
                               {
                                   printf("M");
                               }
                               return 0;
                           }
    

    The segment fault will happen in less than a second. If I comment all the printf() and make every thread just run an empty
    loop then the code runs well.

  2. Plasma has two threads and the kernel will panic(page fault) when I run the command ‘kill -9 88’ (for example, plasma has a PID 88 and has two TIDs 88, 89). Sometimes it happens immediately and somtimes it happens when I try to run the next command.

  3. The key 'CapsLk' doesn't work. Maybe need to make a little change in the keycode translation library?

@klange
Copy link
Owner

klange commented Oct 29, 2022

  1. The libc's stdio implementation is not thread safe. This is not a bug, per se, but it is a known deficiency.
  2. This one is interesting, and I see what's happening from the backtrace; I am surprised I hadn't seen this previously...
  3. Depending on what you're running the OS in, it may be impossible to support caps lock; currently, I have not implemented support because I do almost all of my testing and development in QEMU and it doesn't even send a key press for caps lock.

@klange
Copy link
Owner

klange commented Oct 29, 2022

I have pushed a quick fix for the second issue which should more gracefully handle the situation instead of causing a kernel panic, though really there are several problems with threaded processes in the kernel that need to be addressed with more extensive changes. This is not an area I have put much work into.

@klange
Copy link
Owner

klange commented Oct 29, 2022

I have filed #264 to track the implementation of locking in the stdio implementation.

There were two old tickets for supporting caps lock, both of which were closed as part of a clean up of legacy tickets a few years ago. I may re-open one of them, probably #67.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants