Тёмный

What Happens If We Stack Overflow in Linux Kernel 

Nir Lichtman
Подписаться 53 тыс.
Просмотров 25 тыс.
50% 1

Опубликовано:

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 70   
@nirlichtman
@nirlichtman 4 месяца назад
- 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
@vantavoids
@vantavoids 4 месяца назад
im so glad to not be the only one that has the kind of intrusive thoughts that makes you wanna stack overflow a kernel
@SPimentaTV
@SPimentaTV 4 месяца назад
😂
@havok6051
@havok6051 4 месяца назад
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. :)
@DimDima09
@DimDima09 4 месяца назад
Hi! what will happen if you remove die() or other interruption in kernel code? what would happen on StackOverflow?
@BenjaminWheeler0510
@BenjaminWheeler0510 4 месяца назад
I imagine it would just go “off into the weeds” since it has no way to handle an unrecoverable error
@Ed.E
@Ed.E 4 месяца назад
@@BenjaminWheeler0510technically it could keep going but it’s likely memory corruption would cause either an infinite loop or a number of CPU exceptions
@gwentarinokripperinolkjdsf683
@gwentarinokripperinolkjdsf683 4 месяца назад
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
@jackkendall6420
@jackkendall6420 4 месяца назад
It'll get removed as a duplicate by a moderator.
@ayyyylmao-rg3ik
@ayyyylmao-rg3ik 4 месяца назад
Thank you for showing so many interesting stuff on your channel, a peak into the inner workings of things is always great.
@AntonioDoesMetal
@AntonioDoesMetal 4 месяца назад
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
@Hans_Magnusson
@Hans_Magnusson 4 месяца назад
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…
@ABCABC-sw8mh
@ABCABC-sw8mh 4 месяца назад
Nice vid, looked similar vid a few weeks ago. Simple, good understandable, short, nice vid Thanks Nir
@salsaman
@salsaman 4 месяца назад
but what does die() do ? - Potentially the most interesting part here.Maybe we need another video - "What happens when the Linux kernel dies ?"
@Nunya58294
@Nunya58294 4 месяца назад
It makes me happy to see new comers try this stuff out; It's how you learn and become better at programming, etc
@vikenemesh
@vikenemesh 4 месяца назад
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!
@Maric18
@Maric18 4 месяца назад
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
@kpjVideo
@kpjVideo 4 месяца назад
Another excellent video! Keep up the content man this is great stuff
@BenjaminWheeler0510
@BenjaminWheeler0510 4 месяца назад
I’d be interested about what the convention is for kernel dev. I presume kernel maintainers generally avoid recursion?
@pachinger
@pachinger 4 месяца назад
Same thought here… also, does that mean kernel code is always free of any warnings?
@Ed.E
@Ed.E 4 месяца назад
@@pachingeryes, though the rules are set up so any irrelevant warnings may be changed to notes or discarded
@paulstelian97
@paulstelian97 4 месяца назад
Generally no recursion, though in some situations you do get some (btrfs for example uses up a lot of stack space)
@roz1
@roz1 4 месяца назад
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
@nirlichtman
@nirlichtman 4 месяца назад
Yes I plan on also making videos about the boot process focusing on a specific subsystem each time
@roz1
@roz1 4 месяца назад
@@nirlichtman Thank you so much ❤️ That would mean a lot to all of the people here .... Again Thank you
@justinnamilee
@justinnamilee 4 месяца назад
Oh, fun! Some useful QEMU tips, too.
@Jifaxin
@Jifaxin 4 месяца назад
you have already made a video about creating windows for X11 and Windows. Will there be a Wayland?
@bhaveshverma8629
@bhaveshverma8629 4 месяца назад
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.
@Alex-kj9rc
@Alex-kj9rc 3 месяца назад
Great video!
@starc0w
@starc0w 4 месяца назад
Very interessting, thanks! ❤
@diminuendos_
@diminuendos_ 4 месяца назад
Thanks! Can you pls share how to setup qemu on windows and development environment for linux kernel to try out these examples?
@nirlichtman
@nirlichtman 4 месяца назад
Added setup information to my welcome link on my channel :)
@Onyx-it8gk
@Onyx-it8gk 4 месяца назад
Can you make a small Linux distro with the Rust coreutils?!!!
@nihil75
@nihil75 4 месяца назад
Exactly what I wanted to ask / watch!!!! 🥰
@leonardotry
@leonardotry 4 месяца назад
Now what if you remove the stack guard handler and allow it to "really" overflow? how would that system crash look? :D
@UltimatePerfection
@UltimatePerfection 4 месяца назад
I would love to know what Linus would say about this change 😂
@fderty4
@fderty4 4 месяца назад
when I encounter a stack overflow, I ask for advice on stackoverflow 😏
@Rametesaima
@Rametesaima 4 месяца назад
Random question. @5:08 ... how did get the list of files in the bottom split so you could move between them in the upper split in vim?
@nirlichtman
@nirlichtman 4 месяца назад
Checkout the video about project files search on my playlist "Vim Tips"
@Rametesaima
@Rametesaima 4 месяца назад
@@nirlichtman Much appreciated 🙂
@aviinl1
@aviinl1 4 месяца назад
curious what happens if you comment out that call to `die` and `panic`
@Ed.E
@Ed.E 4 месяца назад
Memory corruption, CPU memory exceptions
@weathercontrol0
@weathercontrol0 4 месяца назад
Kernel_innit
@energy-tunes
@energy-tunes 3 месяца назад
What do tou do for work
@pingu0b
@pingu0b 4 месяца назад
Are you using WSL in the video ?
@SpiderUnderUrBed_Alt
@SpiderUnderUrBed_Alt 4 месяца назад
He is
@pingu0b
@pingu0b 4 месяца назад
@@SpiderUnderUrBed_Alt thanks. i just had a doubt cuz it looked a bit different then usual wsl
@angelffg
@angelffg 4 месяца назад
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
@ChandrashekarCN
@ChandrashekarCN 4 месяца назад
💖💖💖💖
@BenjaminWheeler0510
@BenjaminWheeler0510 4 месяца назад
Kernel panic attack :(((
@simetrii76
@simetrii76 4 месяца назад
noooo :(
@A5A5A5A5h
@A5A5A5A5h 4 месяца назад
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.
@paulstelian97
@paulstelian97 4 месяца назад
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
@iDontProgramInCpp 4 месяца назад
The CPU will fail to call the division error interrupt causing a general protection fault or double fault (don't remember which)
@paulstelian97
@paulstelian97 4 месяца назад
@@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.
@A5A5A5A5h
@A5A5A5A5h 4 месяца назад
@@paulstelian97That’s sounds like a reasonable way to reboot your machine when you don’t have an ACPI driver 😁
@paulstelian97
@paulstelian97 4 месяца назад
@@A5A5A5A5h Except it doesn’t really reboot the whole machine. Only a single CPU core is affected. In HT, only one thread is affected.
@bramfran4326
@bramfran4326 4 месяца назад
cool !
@zawadhyaa
@zawadhyaa 4 месяца назад
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
@Nunya58294
@Nunya58294 4 месяца назад
It's actually possible I had found an article on it. You can make a module without needing the kernel sources
@zawadhyaa
@zawadhyaa 4 месяца назад
@@Nunya58294 no that I know, my focus was on the second part
@zeteya
@zeteya 4 месяца назад
How did you compile the kernel so fast? Normally it takes 30mins or so right?
@SkySumisu
@SkySumisu 4 месяца назад
He divided it into eight distinct processes.
@nirlichtman
@nirlichtman 4 месяца назад
I already ran make before, so when I started make again it only built according to the changes in the source I made
@nihil75
@nihil75 4 месяца назад
Thanks! fun to look at something so familiar in a new way. But I have to say... "Works on Linux kernel, builds on Windows..." 🤣
@ProSureString
@ProSureString 4 месяца назад
hi!
@vlc-cosplayer
@vlc-cosplayer 4 месяца назад
The rudest StackOverflow user would still be no match for Linus at his most polit-- wait, it's not that kind of stack overflow?
@Paolog_
@Paolog_ 4 месяца назад
the only problem that we can't solve when beeing root
@Nunya58294
@Nunya58294 4 месяца назад
Sometimes you need to be root for this stuff...
Далее
Making Minimal Linux Distro with Buildroot
8:38
Просмотров 30 тыс.
Making Minimalist Web Server in C on Windows
10:52
Просмотров 9 тыс.
TEAM SPIRIT: НОВЫЙ СОСТАВ. SEASON 24-25
01:31
Linux Mint vs... Linux Mint (Debian Edition)
17:43
Просмотров 270 тыс.
How Linux Kernel Prints Text on Screen
12:46
Просмотров 70 тыс.
What Happens When Booting Linux with Low Memory
5:11
What Everyone Missed About The Linux Hack
20:24
Просмотров 286 тыс.
Screwing Up Linux Kernel Keyboard Driver
6:33
Просмотров 27 тыс.
Making Simple Graphical Linux Distro from Scratch
17:19
The Only Database Abstraction You Need | Prime Reacts
21:42
Adding Simple System Call in Linux Kernel
7:44
Просмотров 16 тыс.
The Unreasonable Effectiveness of Linux Workstations
12:47