- For more information about how the guard pages are used in the kernel to detect stacko check out this article from the kernel docs docs.kernel.org/mm/vmalloced-kernel-stacks.html - In this video I demonstrate with x64, but on other architectures (like ARM for example) this may work differently
It's funny how the man addresses a very specific programming "prank" that only people familiar with IT can understand, yet he still explains that you should press Enter to opt out of an option in the GUI. :)
@@BenjaminWheeler0510technically it could keep going but it’s likely memory corruption would cause either an infinite loop or a number of CPU exceptions
If you remove the handler for CPU exceptions, they generate a double fault, if you remove that, or the code for it is unreachable (for instance, you get a segmentation fault when trying to reach that code) then it will generate a triple fault and reboot your machine
Such a fun video, I’ve never really thought too much about kernel issues like this. It’s very easy to forget it even exists and has to follow the same rules when developing user mode software
Yep, redirection to the serial port is a good one. Used it when I fixed a NIC driver for SCO UNIX way back in the good old days. Just capture the output to a file and you have an excellent source of information without cluttering your console. I redirected the debug messages only…
Didn't expect to be taken on such a journey in 5 minutes! Thanks for showing how easy qemu is, this might stir some inspiration for potential kernel hackers, I guess!
Hi @Nir Licthman this is a wonderful video... Can u make a sereis on the linux kernel internals the code walk through and steps that the kernel takes from start to finish
How do you know in depth knowledge about these things. I wonder i can learn that too. But these things are very much complicated and goes over my head. I am just a normal web back developer.Really your videos are very good.
Good video!!!! Nir, I have a question please: I run this program on Windows and Linux, on Linux it takes less than 1 second and on Windows it takes almost 2 minutes. Why does that happen? #include #define MAX 1000000 int main(int argc, char *argv) { int i; for(i=1;i
Try make a video where you disable the ISR(Interrupt service routine) in charge to manage division by zero, then try to run such division in user space and see what happens.
Well obviously the CPU can't handle it so the ISR is triggered. So it depends on _how_ you remove it. Remove the code in it? Handler does nothing, you have a CPU bound infinite loop that the scheduler can still deal with. Remove it from the ISR table? Kernel panic (double fault -- invalid ISR entry). You can also try to not change the kernel and register a signal handler for SIGFPU in the userspace, and if you do nothing in that you're gonna again have the infinite loop.
@@iDontProgramInCpp If an IRQ handler is invalid then the double fault shall be called. If the double fault handler is also invalid a triple fault, which leads to an immediate CPU core/thread reset, occurs.
Next video create a kernel module from scratch but something interesting, like a kernel mod to put a camera filiter or a voice filter or a custom keyboard mapping something like that would be really fun
- For more information about how the guard pages are used in the kernel to detect stacko check out this article from the kernel docs docs.kernel.org/mm/vmalloced-kernel-stacks.html
- In this video I demonstrate with x64, but on other architectures (like ARM for example) this may work differently
It's funny how the man addresses a very specific programming "prank" that only people familiar with IT can understand, yet he still explains that you should press Enter to opt out of an option in the GUI. :)
im so glad to not be the only one that has the kind of intrusive thoughts that makes you wanna stack overflow a kernel
😂
Hi! what will happen if you remove die() or other interruption in kernel code? what would happen on StackOverflow?
I imagine it would just go “off into the weeds” since it has no way to handle an unrecoverable error
@@BenjaminWheeler0510technically it could keep going but it’s likely memory corruption would cause either an infinite loop or a number of CPU exceptions
If you remove the handler for CPU exceptions, they generate a double fault, if you remove that, or the code for it is unreachable (for instance, you get a segmentation fault when trying to reach that code) then it will generate a triple fault and reboot your machine
It'll get removed as a duplicate by a moderator.
Thank you for showing so many interesting stuff on your channel, a peak into the inner workings of things is always great.
Such a fun video, I’ve never really thought too much about kernel issues like this. It’s very easy to forget it even exists and has to follow the same rules when developing user mode software
Yep, redirection to the serial port is a good one. Used it when I fixed a NIC driver for SCO UNIX way back in the good old days.
Just capture the output to a file and you have an excellent source of information without cluttering your console.
I redirected the debug messages only…
lol i was kind of expecting an angry linus mail about people doing like mid tier coding advice in merge requests to the kernel like stack overflow
I love your videos, straight to the point
It makes me happy to see new comers try this stuff out; It's how you learn and become better at programming, etc
but what does die() do ? - Potentially the most interesting part here.Maybe we need another video - "What happens when the Linux kernel dies ?"
Nice vid, looked similar vid a few weeks ago.
Simple, good understandable, short, nice vid
Thanks Nir
Didn't expect to be taken on such a journey in 5 minutes!
Thanks for showing how easy qemu is, this might stir some inspiration for potential kernel hackers, I guess!
Another excellent video! Keep up the content man this is great stuff
I’d be interested about what the convention is for kernel dev. I presume kernel maintainers generally avoid recursion?
Same thought here… also, does that mean kernel code is always free of any warnings?
@@pachingeryes, though the rules are set up so any irrelevant warnings may be changed to notes or discarded
Generally no recursion, though in some situations you do get some (btrfs for example uses up a lot of stack space)
Oh, fun! Some useful QEMU tips, too.
Very interessting, thanks! ❤
Hi @Nir Licthman this is a wonderful video... Can u make a sereis on the linux kernel internals the code walk through and steps that the kernel takes from start to finish
Yes I plan on also making videos about the boot process focusing on a specific subsystem each time
@@nirlichtman Thank you so much ❤️
That would mean a lot to all of the people here .... Again Thank you
you have already made a video about creating windows for X11 and Windows. Will there be a Wayland?
How do you know in depth knowledge about these things. I wonder i can learn that too. But these things are very much complicated and goes over my head. I am just a normal web back developer.Really your videos are very good.
Thanks!
Can you pls share how to setup qemu on windows and development environment for linux kernel to try out these examples?
Added setup information to my welcome link on my channel :)
Can you make a small Linux distro with the Rust coreutils?!!!
Exactly what I wanted to ask / watch!!!! 🥰
I would love to know what Linus would say about this change 😂
Now what if you remove the stack guard handler and allow it to "really" overflow? how would that system crash look? :D
Kernel_innit
Good video!!!!
Nir, I have a question please:
I run this program on Windows and Linux, on Linux it takes less than 1 second and on Windows it takes almost 2 minutes.
Why does that happen?
#include
#define MAX 1000000
int main(int argc, char *argv)
{
int i;
for(i=1;i
curious what happens if you comment out that call to `die` and `panic`
Memory corruption, CPU memory exceptions
How did you compile the kernel so fast? Normally it takes 30mins or so right?
He divided it into eight distinct processes.
I already ran make before, so when I started make again it only built according to the changes in the source I made
Try make a video where you disable the ISR(Interrupt service routine) in charge to manage division by zero, then try to run such division in user space and see what happens.
Well obviously the CPU can't handle it so the ISR is triggered. So it depends on _how_ you remove it.
Remove the code in it? Handler does nothing, you have a CPU bound infinite loop that the scheduler can still deal with. Remove it from the ISR table? Kernel panic (double fault -- invalid ISR entry). You can also try to not change the kernel and register a signal handler for SIGFPU in the userspace, and if you do nothing in that you're gonna again have the infinite loop.
The CPU will fail to call the division error interrupt causing a general protection fault or double fault (don't remember which)
@@iDontProgramInCpp If an IRQ handler is invalid then the double fault shall be called. If the double fault handler is also invalid a triple fault, which leads to an immediate CPU core/thread reset, occurs.
@@paulstelian97That’s sounds like a reasonable way to reboot your machine when you don’t have an ACPI driver 😁
@@A5A5A5A5h Except it doesn’t really reboot the whole machine. Only a single CPU core is affected. In HT, only one thread is affected.
when I encounter a stack overflow, I ask for advice on stackoverflow 😏
Are you using WSL in the video ?
He is
@@rishaydutt812 thanks. i just had a doubt cuz it looked a bit different then usual wsl
Kernel panic attack :(((
noooo :(
💖💖💖💖
Next video create a kernel module from scratch but something interesting, like a kernel mod to put a camera filiter or a voice filter or a custom keyboard mapping something like that would be really fun
It's actually possible I had found an article on it. You can make a module without needing the kernel sources
@@Nunya58294 no that I know, my focus was on the second part
cool !
Thanks! fun to look at something so familiar in a new way. But I have to say...
"Works on Linux kernel, builds on Windows..." 🤣
The rudest StackOverflow user would still be no match for Linus at his most polit-- wait, it's not that kind of stack overflow?
hi!
the only problem that we can't solve when beeing root
Sometimes you need to be root for this stuff...