Syscalls, Kernel vs. User Mode and Linux Kernel Source Code - bin 0x09

Поделиться
HTML-код
  • Опубликовано: 2 июн 2024
  • We will have a look at what syscalls are and what it has to do with the kernel mode an user mode. We do this by exploring a kernel function and trace it down to the assembler level.
    join the discussion: / 0x09_syscalls_kernel_v...
    =[ ❤️ Support ]=
    → per Video: / liveoverflow
    → per Month: / @liveoverflow
    =[ 🐕 Social ]=
    → Twitter: / liveoverflow
    → Website: liveoverflow.com/
    → Subreddit: / liveoverflow
    → Facebook: / liveoverflow

Комментарии • 171

  • @BurningApple
    @BurningApple 6 лет назад +374

    It was sure I/Opening :D

  • @xXoSmegZoXx
    @xXoSmegZoXx 8 лет назад +273

    It's a shame you have so little views.
    I think your videos are awesome!
    It's very hard to get into "hacking" or basically understanding how computers really work in a fun way.
    I appreciate your effort to make this knowledge easier to acquire.
    Thank you!

    • @LiveOverflow
      @LiveOverflow  8 лет назад +24

      +Shalev Keren Thank you very much! You can help sharing it with other people who might be interested in it :)

    • @damejelyas
      @damejelyas 5 лет назад +8

      not any more

    • @rj-nj3uk
      @rj-nj3uk 5 лет назад +3

      @@LiveOverflow hey. thanks for making this video.

    • @martiananomaly
      @martiananomaly 5 месяцев назад

      Lol

  • @figloalds
    @figloalds 6 лет назад +89

    I thought Linux kernel was complicated.
    Now I'm sure.
    Actually it's the simpler it can be, computing is complex and providing a safe reliable bed for applications to run, live and exit is indeed... Magic. Highest rank of Computer Magic.

  • @Chastor97
    @Chastor97 Год назад +3

    Your English is quite clear and easy to understand by non-native English users

  • @EchoNote
    @EchoNote 6 лет назад +71

    9:06 "Imagine if a process try to read some secrets from another process". A few days ago (January 2018) the google project zero team discovered a bug that does exactly this (meltdown and spectre) hahahaha

    • @alojzybabel4153
      @alojzybabel4153 4 года назад +2

      Gee, I wonder what they needed this vulnerability for :q

    • @abdarafi
      @abdarafi 4 года назад +1

      Wow...

    • @ruadeil_zabelin
      @ruadeil_zabelin 3 года назад +4

      @@alojzybabel4153 It's a hardware vulnerability. It had nothing to do with google. Blame intel and arm.

    • @jebactychpolicjantow5497
      @jebactychpolicjantow5497 2 года назад +4

      this wasn't google, the core behind spectre has been known for quite a while (paper published in ~2003). it's also not "intel and arm"'s fault; it's just a fault of the entire architecture. spectre involves cache speculation being obviously faster than just random accessing of memory; you can use the CPU's cache speculation to read memory in a process that is not yours because it works above paging and the time difference between reading something which is cached and which is not-so could be catastrophically huge.
      it's a fault of the von neumann architecture as a whole. while he did envision that "near instantaneous accessible memory" was required for his architecture he never saw the fact that with an electronic computer (that is able to do shit almost instantly) the sheer size of any memory would be a hinderance, and the mere millimeters that it exists away from the cpu would bottleneck instructions to the point that you can execute millions of instructions before certain pieces of data are returned in a fetch.
      in our greed for speed, we implemented caching in such a way that it breaks another concept we implemented around about the same time (paging). i'm sure we sorta also violated von neumann's vision - a computer program not being able to read the entirety of the memory available to it? that's just silly.

  • @dimimate5522
    @dimimate5522 8 лет назад +68

    Your videos are very good. I have searched and watched many videos on the topic in matter and your work is what exactly i was looking for. Well explained terms, examples with live hands-on-keyboard, short length, references from books used, no sleepy voicing and many more. Your videos are an example of how video tutorials-lectures should be made. Congrats

  • @Linaiz
    @Linaiz 4 года назад +12

    This is amazing, never seen a video before that actually links all these concepts together, this gave me a totally new point of view on this as a student, thank you!

  • @bitcode_
    @bitcode_ 8 лет назад +91

    im learning a lot from your videos, thanks for taking the time to make them, i appreciate it

    • @LiveOverflow
      @LiveOverflow  8 лет назад +7

      +mylampdatabases thank you for those kind words :) If you have any topics you are interested in, or a topic that was too confusing and you need more information, please give me feedback

    • @MonaJalal
      @MonaJalal 8 лет назад +1

      +LiveOverflow please talk about softirq and tasklets :)

    • @housemusic325
      @housemusic325 7 лет назад

      It could be really cool to have a video about badass bash coding.

  • @themanyone
    @themanyone 5 лет назад +11

    This is more my speed. A lot of condensed information in a short time here. Definitely going to have to wake up and drink another cup of coffee before watching it again.

  • @darshannn10
    @darshannn10 Год назад +1

    no matter how many times I come back to this playlist, I always learn something new🙌

  • @guitarscholar
    @guitarscholar 7 лет назад +1

    I love your videos. It is good to dive into topics like this sometimes. It is a taster that makes me want more.

  • @DurgaPrasad3496
    @DurgaPrasad3496 7 лет назад

    you are amazing!. this compliment is not for what i learn from your videos. it is for your way of explanation. because, even some topics i don't understand my temptation doesn't stop me that not see your videos. #LiveOverflow is one of the best channel i am following thank you.

  • @oliver5204
    @oliver5204 8 лет назад

    Very clear and easy to follow, thanks heaps. I know you briefly touched on how to implement a call but perhaps a quick live demonstration would be the only thing missing. Again, awesome work.

  • @graysoncroom
    @graysoncroom 7 лет назад

    Great series so far. You are the first person I have found that goes deep enough to make me think, but not to the point of confusion. I appreciate what you are doing, keep up the good work!

    • @graysoncroom
      @graysoncroom 7 лет назад

      just realized that this video was made a long while ago. All the same, thanks for the content!

  • @Darksider95
    @Darksider95 3 года назад

    awesome video man, in-depth and easy to understand

  • @noicecu8868
    @noicecu8868 5 лет назад

    I always new about Ring0 and Ring3 but I never knew the technical side. Thanks for the useful information and the deadly rabbit hole you just got me in!

  • @Awhx_ella
    @Awhx_ella 6 лет назад

    AWESOME!!! So clear and compact! ... thanks for being so smart and communicative! :D

  • @shravankumarsheri6732
    @shravankumarsheri6732 3 года назад

    watched 2 times to get the grasp of it. Man it was really profound amount of knowledge.

  • @linuxkernelhacking2048
    @linuxkernelhacking2048 8 лет назад +5

    LiveOverflow....I just see your 1st video.................Damn Its awesome :-)

  • @balkan917
    @balkan917 4 года назад

    this is exactly I was looking for, thank you!

  • @c1onqht
    @c1onqht 3 года назад

    I started learning the assembly and found it really difficult. Hope watching your video will help me more in learning :D

  • @krzysztofadamski2884
    @krzysztofadamski2884 7 лет назад +16

    This video is very good and you are really good at explaining complex stuff. This of course requires making some simplifications and it's quite easy to make things wrong when you do that. Claiming that the mov instruction inside of __get_user_asm is an example. While this is possible, its not what will usually happen. In most cases the page will be available in the memory (won't be swapped out) and no page fault will be done. As you explained before, resolving virtual addresses is done transparently by MMU, which is reprogrammed each time a process is scheduled.

    • @LiveOverflow
      @LiveOverflow  7 лет назад +5

      +Krzysztof Adamski thanks for the additional info. I don't know the low level kernel stuff too much but was hoping that it's enough to create some intuition for it.

    • @niente11111111111111
      @niente11111111111111 3 года назад +2

      @@LiveOverflow if i supply a virtual address to copy_from_user and eventually there will be the mov when the process hits that mov won't the MMU translate automatically the virtual address into a physical one?

    • @U20E0
      @U20E0 2 года назад

      @@niente11111111111111 that is exactly what the original comment said

  • @hl2mukkel
    @hl2mukkel 7 лет назад

    This one was very interesting! Thanks for this one =D

  • @fpostolache
    @fpostolache Год назад

    Great introduction. Thanks for sharing !

  • @migueld2456
    @migueld2456 8 лет назад +1

    Your videos are fantastic!

  • @alkeryn1700
    @alkeryn1700 5 лет назад +1

    first time i watched this video few month ago i didn't quite understood everything
    learnt assembly recently and now i'm like "bruh its the basics"
    but thanks anyway you made few things more clear

  • @KeithMakank3
    @KeithMakank3 5 лет назад +3

    0:50 the funny thing about calling them an interface between things, is that the interface itself must then exist in a domain of its own (otherwise it isn't an "interface" but part of one "face" inside another - difference is crucial), of course being again either user or kernel land. In reality syscall implementation always exists in both of course.

  • @mnemonic6502
    @mnemonic6502 4 года назад

    This is excellent! At the level I wanted to know.

  • @lookback6314
    @lookback6314 2 года назад

    Thanks! Your videos are invaluable!

  • @MrGeekGamer
    @MrGeekGamer 7 лет назад +3

    strace just blew my mind.

  • @sharatht8909
    @sharatht8909 3 года назад +1

    I was always afraid of binary exploitation and stuff around binaries.
    I really appreciate your work here.
    Thanks for the big help. As you said, I got lost in your series and wonder what I can get more in this video series.

  • @kltf34cgsdawe9
    @kltf34cgsdawe9 3 года назад +3

    nice , but you wrong at 11:57 there will be no page fault ( only happen on special cases like addresses not belong to the process address space or swapped ) kernel will be mapped across all processes ( but protected from access ) so kernel can access process memory just by VA and MMU will convert to PA as usual

  • @jt-kv3mn
    @jt-kv3mn 5 лет назад

    Simple and honest ! thaaaank youuu ! great great great !

  • @arivanhouten6343
    @arivanhouten6343 3 года назад

    Still a good series! Can recommend this to everyone!

  • @FATTIdotCOM
    @FATTIdotCOM 3 года назад

    Great video thanks. Very detailed contents. The author did a great job.

  • @JohnSmith-he5xg
    @JohnSmith-he5xg 7 лет назад

    Fantastic intro to syscalls!

  • @patrickmullen2914
    @patrickmullen2914 Год назад

    Great video, a thumbs up 👍

  • @sususu9
    @sususu9 2 года назад

    this channel is a blessing

  • @user-wl9zo2mi4u
    @user-wl9zo2mi4u 5 лет назад

    You want feedback? Here is the fb. You job is really good! Very clear and good enough !

  • @10FactsShow-10factshow
    @10FactsShow-10factshow 10 месяцев назад

    RDMSR(Read MSR) is a kernel level command how it can be execute in user mode,so there is much detail you are missing but its a great video

  • @SSB2706
    @SSB2706 3 года назад

    Superb explaination

  • @edgeeffect
    @edgeeffect 2 года назад

    I'm at some grey area between n00b and leet.... and I these videos are neither too simple nor too complicated for me.. NICE!

  • @samarthtandale9121
    @samarthtandale9121 Год назад +1

    Amazing Content !!!

  • @user-xs3rz1jj4i
    @user-xs3rz1jj4i 5 лет назад

    thank i love your video~ please do more

  • @uohwhoru3473
    @uohwhoru3473 3 года назад

    bruh and i thought learning this is hard lmao thanks for the ez explaining ❤️

  • @stankojankovic
    @stankojankovic 8 лет назад

    This is great. Thanks!

  • @ajaysureshkumar1533
    @ajaysureshkumar1533 4 года назад

    One of the best playlists for hackers...And the best playlist for reverse engineering!!!
    And I am sad that this playlists have less views than the other stupid hack vdos..where most of them are fake ones ..And most of them are like making use of tools which contributes 0% to computer knowledge which are making backdoor and getting control of data..Hacking is something far than that.......This channel teaches us the real skills required for hacking like knowing the inner working of computer and how do they process data and how can you trick the computer.. Most channel teaches us how to do it..But this channel teaches how to do it and why did this happen..And huge respects to this man who did this vdos free for us to watch .May ur channel grows exponentially over time..And really sorry bcoz of posting the comment after u have asked the feedback ..Ur teaching is really great dude.And pls make a new playlist for web application penetration testing by starting from sql injection to advanced web application attacks ..Pls sir ur teaching is really gud ..And btw i am a great fan of ur vlogs

  • @bradlee9242
    @bradlee9242 5 лет назад

    Great video, thanks

  • @Andruhass
    @Andruhass 4 года назад

    Wow. That was awesome 👍

  • @ziyangxie8607
    @ziyangxie8607 3 года назад

    that's a really great video

  • @RamakrishnaJK
    @RamakrishnaJK Год назад

    Great Great Great Video.. Thanks a lot..

  • @mrwayofwarrior7853
    @mrwayofwarrior7853 4 года назад +1

    hey liveoverflow, du bist mein totemtier :D

  • @whocares3061
    @whocares3061 7 лет назад

    sehr gutes video!

  • @F1mus
    @F1mus 6 лет назад

    Very cool video :)

  • @supertren
    @supertren 7 лет назад

    wow!!. Thank you very much!.

  • @snorman1911
    @snorman1911 2 года назад

    Enjoying your instruction on Lennox Cisco's sir!

  • @four0two167
    @four0two167 8 лет назад

    Great videos! Although you are right in making assumptions that we understand what is clear to you, this makes us read more in detail about this. (And when you do this, it does not create any big gaps in - my - understanding.) For example the reverse engineering of the license check program, which I did not understand fully to begin with.
    Thank you!
    I would like to see some videos about reverse engineering in general, to help make life easier. Keep on doing this please!

    • @LiveOverflow
      @LiveOverflow  8 лет назад +1

      +four0 two1 could you elaborate on "reverse engineering in general"? What is your imagination of reverse engineering? Any particular example in mind? I reverse engineered a simple C program with the license check. But you could also reverse engineer a protocol. Or hardware. Or a fileformat... etc

    • @four0two167
      @four0two167 8 лет назад

      I would like to know everything. So maybe some more advanced examples of code in C, Python and ASM? Because I am not really educated enough on such subjects to make good guesses on what code do.

  • @abhinavkishoregv273
    @abhinavkishoregv273 3 года назад

    I did not understand the syscall code part.
    Not your fault.. I m a noob linux kernal programming
    It inspires Me to Start learning more about these Thanks

  • @lilp4p1
    @lilp4p1 7 лет назад

    i love youre videos :)

  • @coolwinder
    @coolwinder 7 лет назад +15

    i love you man

  • @yonite4355
    @yonite4355 Год назад

    awesome video

  • @Aragubas
    @Aragubas 16 дней назад

    wow great video

  • @johnhammer8668
    @johnhammer8668 5 лет назад

    You videos are way too good. Can't believe i have'nt found more than 2.5 years.

  • @techtalk668
    @techtalk668 4 года назад

    Awesome content just awesome

  • @revoiceful
    @revoiceful 7 лет назад +1

    Thank u so much

  • @_sudipidus_
    @_sudipidus_ 4 года назад

    I guess I am not ready for this yet.. but I will come again soon :)

  • @ifthekharhasan7817
    @ifthekharhasan7817 7 лет назад

    Just awesome.

  • @SolomonUcko
    @SolomonUcko 3 года назад

    Around 3:20: FWIW, I think `puts` would probably have much less wrapper overhead than `printf`, since it doesn't have to do all the format string parsing and processing.

  • @ThiagoQwertyuiop
    @ThiagoQwertyuiop Год назад

    thank you!

  • @shaswata56
    @shaswata56 5 лет назад

    I've watched some hacking videos of yours. I was amazed by your pace! You're 1337 . You deserve more subscriber(I know you don't need that). You show everything so precisely!!! Respect 👍👍

  • @JGunlimited
    @JGunlimited 5 лет назад +1

    @3:00 Is it possible to just skip to 'syscall' instead of stepping through each instruction?

  • @zatochiSiberian
    @zatochiSiberian 4 года назад

    Thanks!

  • @effexon
    @effexon 3 года назад +1

    Is it that Vic20 or Commodore64 dont have these rings, but you can write and run which opcode you want? Then 486 already has those rings and this applies...

  • @Jonathan-ru9zl
    @Jonathan-ru9zl Год назад

    Excellent. Should i see the former videos to understand this?

  • @robbrock9766
    @robbrock9766 7 лет назад

    I love your videos, can you do a video going over the Memory Sinkhole issue on x86 intel chips. I saw a video on it but I would love to see the code to make it happen.

  • @tomservo5007
    @tomservo5007 7 лет назад +1

    What I'm confused about is how userland programs execute a privileged cpu opcode. Example, get the value of opcode RDPMC (x86)
    #include
    int main() {
    unsigned long long int x;
    __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
    printf("x = %lld
    ", x);
    }
    ---------------------
    does this cause a general protection fault and the kernel 'runs' this ?

  • @AlanMedina314
    @AlanMedina314 3 года назад

    I hope to someday have a basic understandig of the linux kernel.
    Video reinforces how much I still need to learn.
    My brain overheated for a good reason.

  • @hiimthelegend6644
    @hiimthelegend6644 6 лет назад

    You recommend some documentation but it's good to paste links for them in the description of video.

  • @itZMySound
    @itZMySound 5 лет назад

    At 5:24 we load the number corresponding to the write syscall. Would it be possible using a debugger (or something else?) to change what is loaded into eax and make the syscall invoke another function?

    • @Julesoby
      @Julesoby 5 лет назад

      Yeah, definitely. The result would be quite random tho, as the different syscall signatures can differ a lot.

  • @vequeemnheveque3778
    @vequeemnheveque3778 8 лет назад

    Thanks

  • @sashastadnik9347
    @sashastadnik9347 2 года назад +1

    if you reach this error `implicit declaration of function ‘write’` when compile `write_test.c` just add `#include `

  • @HootanHM
    @HootanHM 5 лет назад +3

    It's ~9 years that I'm learning about computers. so, I already know something.
    I was thinking how many years I would have saved if there was someone to teach me these things as you do.
    please go on with this series.
    and if you have some experience in embedded systems security, please share it with us.
    It would be fun to hack into things and learn how to write more secure code.
    tnx

  • @pedrofam8302
    @pedrofam8302 3 года назад

    god, this is awsome

  • @kimchi_taco
    @kimchi_taco 5 лет назад

    the world is wide and genius are abundant

  • @Ajithkumarsekar96
    @Ajithkumarsekar96 5 лет назад

    12:30 very true words

  • @peyastig6371
    @peyastig6371 5 лет назад +2

    And how did you exactly learn all of this? Just from reading documentations??

  • @phoenix2464
    @phoenix2464 6 лет назад

    2:47 what version of radare2 is this ? how did you get this view ?

    • @phoenix2464
      @phoenix2464 6 лет назад

      never mind turns out i had an old version..

  • @samarthtandale9121
    @samarthtandale9121 Год назад

    Basically what that means is the kernal gives some address space to each process and this chunk of address space is called as linear address in that process, Right?

  • @gardedesombres3254
    @gardedesombres3254 4 года назад

    Thank you. Is there a book or a resource where can i learn this kind of stuffs deeply ?

    • @BeLuckyDaf
      @BeLuckyDaf 3 года назад +2

      Hey there, yes here are the two books you'll get the most of it from.
      Modern Operating Systems, by Andrew S. Tanenbaum;
      The Linux Programming Interface
      , by Michael Kerrisk.

  • @procrast
    @procrast 6 лет назад

    yeah, thank you

  • @Alexex2353
    @Alexex2353 7 месяцев назад

    I understood barely a 10% of that, but very interesting

  • @00eunderscore70
    @00eunderscore70 Год назад

    Hi are there any other things books that can help me understand the Memory - -and kernel basics

  • @carlosgarcialalicata
    @carlosgarcialalicata 3 года назад

    I would like to see such a deep dive for hypervisor. and maybe compare with this. PS: how can I give double or triple likes to a video?

  • @Borgimanio
    @Borgimanio 8 лет назад

    Where did you learn all this? All by yourself or somewhere in university?

    • @LiveOverflow
      @LiveOverflow  8 лет назад +2

      +Borgimanio Mostly by myself. I studied computer science and I went to an IT school. So those lectures certainly provided some information that helped to get me started.

  • @sagarbanwa218
    @sagarbanwa218 6 лет назад

    Is it possible to write root exploit with this ?? Just a question still I am a learner

  • @suryasikharej5511
    @suryasikharej5511 8 месяцев назад

    @3:42 Where does the address stored in IA32__LSTARMSR POINT TO.? I mean what does that address contain?

  • @unicojeito
    @unicojeito 5 лет назад

    Best video ever! Thanks. Just didn't get at 6:48 when it shows four gdb windows and the note says "look at the address of main() it's always 0x4005db"

  • @preethamgali3023
    @preethamgali3023 5 лет назад

    @LiveOverflow, what books do you refer to learn all this cool stuff ? And how do you know what to learn ?

  • @Mike-kq5yc
    @Mike-kq5yc 6 месяцев назад

    Why length is 5? What is about the Null Byte?

  • @metaldownm
    @metaldownm 7 лет назад +1

    really well explained! sind Sie Deutsch?