strace feels like magic - let’s fix that (with Rust)

Поделиться
HTML-код
  • Опубликовано: 29 июл 2024
  • Follow me on Mastodon: hachyderm.io/@fasterthanlime
    Support me on Patreon or GitHub: fasterthanli.me/donate
    You can find the code at: github.com/fasterthanlime/rue
    How to build a Rust service with Nix (new series): fasterthanli.me/series/buildin...
    Contents
    00:00 What is a full-stack engineer?
    00:48 What's a syscall?
    03:38 Tracing cat
    05:43 Should strace work? Let's think security
    07:14 Sponsor (wink wink)
    08:21 How is a process created?
    10:36 Trace me! Trace meeee
    12:10 ptrace 101
    13:15 Ok but seriously, what's a syscall?
    14:00 We're ready to make an strace-like
    15:10 Thanks to my patrons & sponsors
    15:50 Surely no one watches this far
  • НаукаНаука

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

  • @fasterthanlime
    @fasterthanlime  Год назад +39

    Code for this video is here: github.com/fasterthanlime/rue
    But if you want a real strace-like in Rust, look up lib.rs/crates/lurk-cli

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

      Code in the repo is not the latest version shown in the video

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

      @@thomasq5186 it wasn't indeed, I've just pushed the missing changes.

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

      @@fasterthanlime thank you :) would you accept PRs in that repo or are these video projects done when the video is published?

    • @fasterthanlime
      @fasterthanlime  Год назад +10

      @@thomasq5186 the repo should reflect the state of the project as built in the video - but I'm happy to link to forks that do interesting things!

  • @m.minkov
    @m.minkov Год назад +377

    Please never stop making content. The content out there for intermediate/advanced engineers that are past building tutorials is somewhat scarce, you provide a great niche in people wanting to gain even deeper understanding. Thank you!

  • @MartinGeisler
    @MartinGeisler 8 месяцев назад +3

    I swear, when my braind heard you say the phrase "And this is why, in a lot of my content, I use the tool...", it automatically thought it was a segue into a bit about the sponsor of the video 😄
    Great video, the production quality is amazing. Thanks for passing on this low-level knowledge!

  • @AdamChalmers
    @AdamChalmers Год назад +11

    This is really well produced. I generally prefer reading articles and don't usually watch programming videos but wow, this one has changed my mind. Thanks for making this, I learned a lot.

  • @Dorumin
    @Dorumin Год назад +45

    Hysterical, your articles are already pretty funny but you're a great editor and personality too. I think this is one of your best

    • @fasterthanlime
      @fasterthanlime  Год назад +13

      Thanks so much, this means a lot. People tend to say "I can't absorb technical content in video form" and while for some that may be true, I think for others I simply wasn't trying hard enough 🧐

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

      @@fasterthanlime Yeah, when it's this well presented, it can be absorbed ;) You explain a tad too fast, but nothing that a few pauses or rewinds can't solve. Very cool content as always dude!

  • @BeachFrontSolutions
    @BeachFrontSolutions Год назад +33

    Hey Amos! Loved the video. As someone who has been working as a systems engineer for almost 9 years ( last 4 moved me into the software side) I am consistently amazed at how easy to digest you make very technical topics!
    I’ve only found your channel about a week ago and I am slowly working through your back catalogue of both videos and articles. Your “sponsored by” spot was excellent and it reminded my to go sponsor on patreon. The enjoyment and inspiration you have given me is worth more than any other subscription I currently pay for! Keep up the great work.

    • @fasterthanlime
      @fasterthanlime  Год назад +2

      Thanks so much for the kind words and enjoy!

  • @sombrastudios
    @sombrastudios Год назад +5

    The quality of your videos becomes more and more INSANE.
    I am just in awe about how you do it. I made peace with you being a better coder than I am, but you being this good of an editor, that's just hard to swallow

  • @Kiaulen
    @Kiaulen Год назад +61

    I appreciate that your strace has colors. It's like going from cURL to httpie. They do basically the same things, but one is much prettier.

    • @fasterthanlime
      @fasterthanlime  Год назад +27

      Yeah I didn't really explain that part in the video, and it wasn't in my initial research version, but lib.rs/crates/owo-colors makes it so easy to add colors, I couldn't resist! Makes the video a bit more readable, too.

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

      every day, i learn of new epic programs

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

      @@fasterthanlime whats better?
      owo-colors
      or colored
      ive recently started a project where i used the latter
      how does owo-colors compare to colored

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

      @@RenderingUser iirc colored is dead (still works though) so owo-colors

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

      @@hmmmyessssssss7270 rust programs are never dead, they are complete

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

    When I was young I was writing random urls in my diary, kind of like I had my own index. I think I had somewhere between 5000 urls mostly collected from newspapers. Early signs are always there.

  • @Cornyfisch
    @Cornyfisch Год назад +16

    humorous and informative, best combo, thank you so much for these videos!
    also the Straße joke was really ... albern. :D

    • @fasterthanlime
      @fasterthanlime  Год назад +19

      According to my analytics, Germany is the country with the 2nd most viewers on my channel, so you can expect more dubious German jokes. As a Swiss-French (and a fellow European) I feel like they're fair game 🧐

    • @Cornyfisch
      @Cornyfisch Год назад +5

      @@fasterthanlime Sure thing, I hope I didn't come across as rude, I appreaciate all kinds of jokes :)

    • @fasterthanlime
      @fasterthanlime  Год назад +6

      @@Cornyfisch no worries! My content is full of pretty silly jokes. It makes intimidating concepts a bit more approachable and help with pacing.

    • @SianaGearz
      @SianaGearz Год назад +2

      @@fasterthanlime As a matter of fact, i would vastly enjoy videos peppered by cross-language puns, since i understand at least a little of most European languages (excluding Basque, Hungarian and Finnish). Americans will be so pissed off though. Is it worth it?

  • @bene7042
    @bene7042 Год назад +2

    I love how indepth your videos are!
    Also: The editing on this video is really good with the strace output

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

    Your videos are really well made + edited, not to mention the information you give is helpful. Fills a void that very few others fill. Thanks a lot for doing this (you also earned a sub)

  • @5V500mA
    @5V500mA Год назад

    The speed of the of the video together with the sound effects is just exactly right for me. Thank you!

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

    You make an awesome job!
    Very good explanation of what happens during program execution and what the kernel actually does in this context.
    I love it!

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

    I could never judge you bear. really cool video, gonna have to go over it a few times to really understand but this is complex stuff so that's okay. Also excellent editing! well done!

  • @EbbDrop
    @EbbDrop Год назад +2

    Love the sound work in this one!

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

      Thanks! It's something I'm trying to get better at :)

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

    I cannot express how much I enjoy watching your content, please keep it up!

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

    Absolutely great content! Thank you for the work and ideas you put in

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

    The increasing quality of your videos is pretty amazing, great job!

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

    LOL, Amos! Very good quality editing and jokes.
    You packed this video with a lot less information than I expected, yet it still felt a bit overwhelming. Maybe because of the mayhem... but that was also the fun part x)

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

    Really enjoyed this video, gave me flashbacks to my os course back in uni

  • @DerNivel
    @DerNivel Год назад +4

    I was laughing way too much about the Straße joke. Well played 😂

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

      oh that was a joke? (I thought it was just facts, because I don't speak German.) :facepalm:

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

      @@recklessroges I mean the joke here is that a German person not knowing English would likely pronounce it this way. At least that's how I understood it as a German.

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

    another perfect video thanks amos! 👏

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

    Awesome stuff!!

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

    I wanted to work on my side project but the video was too interesting. Really really good videos!

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

    that end joke lmao (very good video! thanks amos!)

  • @pansysk75
    @pansysk75 Год назад +7

    I've learned more here than one semester's worth of classes in my university, you are very skilled in explaining.
    Thank you!

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

      Then you need to find a better university!! I mean.. thank you very much, glad it helped!

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

    How do you keep pumping up such top tier content? Absolute machine!

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

    I am really happy that I found this channel :)

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

    The end of videos feels like marvel after credits scenes. It's awesome. Your content is awesome.

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

    Great content as always.

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

    Thanks!

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

    Read some of your blogs that show up in TWIR which are always fun, didn’t know you for RUclips videos too

  • @i.8530
    @i.8530 Год назад

    very interesting video, keep it up!

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

    Commenting for the algo yeehaw - awesome content !🎉 Going to pass this on to some of my students - especially the part about fullstack engineering

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

      May the algorithm notice that I'm engaging with my audience. (Also I hope your students like it!)

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

      @@fasterthanlime they've been loving your content as deep dives into Rust concepts!

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

    Great to see nix-profile in there ;)

    • @fasterthanlime
      @fasterthanlime  Год назад +2

      Haha yes, I noticed it too while editing and thought it would be a nice teaser - but then it's during that video that I've announced a 12-part article series about nix!

  • @user-yi9tq7xg2w
    @user-yi9tq7xg2w Год назад

    Great upload rate! Keep it up =)

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

    Get that bread!

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

    I am full stack: I digged out the iron ore myself, smelted it into a computer with relays. Then coded the network code and the spam server on it myself in machine code.

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

    Didn't expect this quality when clicking on the video

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

    Fixedly Staring Amos isn't real, he can't hurt you
    Fixedly Staring Amos: 15:27
    (Have been loving this content, like others said, so great to have approachable videos but on advanced topics; I feel a lot less scared of computers now)

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

      Miguel I don't believe you were ever scared of computers.

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

      @@fasterthanlime I'm sure that if I keep learning about computers I can be more scared of them than ever 😊

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

    When I first saw full-stack engineer I was like, oh boi here we go again, and then you said it was unrealistic and didn't exist, I knew I had to stay to listen to more you had to say

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

    Terrific

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

    LMAO "We love you baby, get that 🍞" 😂

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

    I hope the implication at the end was you're making that memory usage tracer, because that'd be pretty handy

  • @lassdasi
    @lassdasi Год назад +6

    Very nice video!
    Is the "is_sys_exit" toggle really the correct way? It looks a bit hacky.
    How does it handle multi-thread applications?
    Does ptrace really stop all threads simultaneously?

    • @fasterthanlime
      @fasterthanlime  Год назад +4

      Great questions! The boolean is the cheap/fast way of doing it. There's mechanisms to query why the program stopped, but they're more expensive/slower than just keeping track yourself.
      Re multithreading: I did say "threads = processes" (on Linux) and it's particularly visible with pthread. Each thread is a separate tracee and can have a separate tracer. ptrace can notify you when clones happen, which works for both starting children processes and starting new threads.

  • @rutabega306
    @rutabega306 Год назад +2

    Wow this is very high quality - til about strace!

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

      I've learned so much through just using strace on stuff. We have better tools for that now but.. that'll have to wait for another video!

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

    Ok I love this content

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

    Rust and Nix? Oh goodie... Gonna look it up right away. Gute Besserung meanwhile 🖖🏿

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

    Wait, protection rings are a CPU feature? Cool! I will now spend several hours researching this, thank you

    • @fasterthanlime
      @fasterthanlime  Год назад +2

      So the Wikipedia page (serious research I know) mentions that NT & Linux kernels don't necessarily use that feature anymore, but they use the "supervisor/user" mode. I would have to reach out to an expert to make confident statement about the exact details.

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

      @@fasterthanlime Interesting.

  • @cunningham.s_law
    @cunningham.s_law Месяц назад

    for some reason I thought it just loaded it's own glibc wrappers with LD_PRELOAD but that would not work if you were to call the syscalls manually instead of with glibc

  • @soanvig
    @soanvig Год назад +2

    Fun fact: Technically 'cat' program stands for concatenate and is used to concatenate multiple files. At least this is its original UNIX system purpose.

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

      This whole time I thought it was C (see) And Talk.

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

      @@raffimolero64 `man cat`:
      `cat - concatenate files and print on the standard output`

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

      @@raffimolero64 I didn't use UNIX system, but my guess is that in some UNIX guideline books for viewing files you would use `vi`, not `cat` :p Maybe `less`. In fact viewing files via `cat` is not very handy. `less` is far superior.

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

      Fun fact: this was part of the original script and I cut it while editing the video, in an awe-inspiring act of self-control.

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

      @@fasterthanlime That's hell of a fun fact!

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

    Very cool

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

    Great video as always. I would recommend veering away from the sound effects on the text scroll. It's a bit distracting.

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

    "I guess there were signs--" 😂🤣

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

    Very qualitative content here

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

    Comment so that youtube recommends your great channel to all...
    Great video as always Amos...

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

    Subscribed. Obviously.!

  • @youpapai
    @youpapai Год назад +2

    Beautiful. BTW, Rust program that runs `cat` should be called `rat` 🐀. Like rat on syscalls 😀

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

      We do that with many Rust portings but: Remote access trojan (RAT) is already a thing, (and really hard to google.)

  • @walidlezzar2357
    @walidlezzar2357 Год назад +4

    Jesus christ, I’m becoming an addict of this channel…
    Amazing content, perfect level of details and explanations, full of useful knowledge. Thank you!
    Ps: Would you be willing some day to share your editing process? How you create animations, how you do the cuts, how you use the editing software, etc. As someone who is trying to start something similar, I realized how difficult this is…

    • @fasterthanlime
      @fasterthanlime  Год назад +4

      I'm resisting the urge to make meta videos like these (the closest would be "This is a video about video") but I can confirm that it is indeed a lot of work.
      I haven't found a great solution for motion graphics yet - I do most of it in DaVinci Resolve directly (rarely even using the Fusion tab). Sometimes I'll build a little thing in the browser to visualize something. I've been trying to find other tools better suited to what I want but none are tightly integrated into Resolve, making it a hassle.

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

      Have you heard of motion canvas? It’s a 3blue1brown-esque animation software/video editor written in Typescript. There’s a video demonstration on RUclips. Might be useful

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

      @@fasterthanlime Did the "make my own RUclips" experiment prove problematic? The video section on your site vanished.

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

    Ya know I saw an article recently about some algorithm being able to calculate where given sequences of π show up, or something like that. Anyways at least you got a cool story to go with your neurosis, they just asked me to tutor HS freshmen in pre-algebra meh

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

    Hey, what is the name of the theme you're using :) ?

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

    fullstack engineer is who that can refine iron ore and silicon ,lithium and other imortant ore than mak tools to make machines to make circuite board and make energy genrator then make all ic and transistors and spreaker and wireless entwork and make dispay with light bulbs and make keyboard etc than write the kernel for it and then make opreating system and make desktop and make broswer with link to other computers with internet and able to make webstie on it an also design all this on figma is what i call the ultimate full stack

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

    need myself a "Don't blame me, it's GNU code" shirt.

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

    Your content is awesome. I've been watching all your videos since "C++ vs Rust: which is faster" and you never miss.
    I did not expect myself be fully attentive throughout an entire technical video, and thanks to you I already did that thrice.
    Keep up the good work!!

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

    OH THERE WERE SIGNS ON SIGNS AMOS :D

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

    There were signs that you’d be a mad scientist. 😂

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

    0:39 It was DNS.

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

    ❤️

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

    Please upload a video on your hair care routine. they are really beautiful.

  • @0xba1
    @0xba1 Год назад

    What do you mean "you can't trust the source code"; do you have links to any articles regarding that? Big fan!

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

      This is somewhat tongue in cheek, but mostly I mean you can't trust your understanding of the code - are you even looking at the right code? Is the compiler doing something unexpected with it? (like if your code has unexpected behavior) etc.
      The "actually" in "what actually happens" is the keyword here.

    • @0LoneTech
      @0LoneTech Год назад +1

      If you're looking into the security aspect of it, Ken Thompson's "Reflections on Trusting Trust" is a classic.

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

    What is syscall on POWER or ARM?

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

      It seems PowerPC has an "sc" isntruction, and arm64 does "svc #0", cf. stackoverflow.com/a/38906005

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

      And RISC-V has `ecall`

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

    10:20 Yes you did use it right, also you have reminded me I haven't visited r/LiminalSpace in a while. Off to... uhm... be liminal? Edit: Actually I will finish the video

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

    haha if you are german straße :) Love it

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

    This shit is fire

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

    > Oh no
    Indeed.

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

    ha, just started strace log parser for fun. wondered if I could just rewrite strace in the end.

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

      There's something very satisfying about being able to move from "scripts that parse the output of Linux system tools" to "directly interfacing with those facilities" - it's not always the strategic thing to do if you're trying to get results quickly, but you do learn a lot!
      Keep in mind that multithreading hasn't been covered at all in this video, whereas strace does handle that case properly.

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

      @@fasterthanlime it's also an attempt to fiddle with parser combinators. And initially I just cared about write-like syscalls synce I use strace to dump some binary data for fuzzing samples. Rabbit hole gets deeper :D
      And yes, I don't care much about multithreading much at this point, since I do not RIIR strace at the moment and just started digging things.

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

    They mistook random strings with code XD

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

    gotta put that german street in there 🤣
    great joke!

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

    lime: ES-trace
    everybody: STrace
    me: STraik xD

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

    Anyone else eager to see a blazing memory profiler?

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

    Hey, great video, just wanted to share Yama is the god of the death in Hinduism.

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

      It absolutely is, and that 2-second segment is a joke I was barely able to stay straight for!

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

    I will never not feel stupid saying kibibytes. I know it's technically correct and an important distinction but for me, 1 kilobyte will always be 1024 bytes.

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

    I ate the penguin, guys. Hope you don't mind

  • @MickGardner-vc4us
    @MickGardner-vc4us Год назад

    bro whats your secret to typing and thinking so damn fast. you're almost superhuman

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

      That's the magic of editing for you! This video is HEAVILY scripted/produced. "Let's build a htop-like" is almost live, but some silent played at 2x. In that case the secret is a loot of prep work.

    • @MickGardner-vc4us
      @MickGardner-vc4us Год назад

      @@fasterthanlime tbh that's really smooth editing, can't even make out any jumpcuts or weird anomalies! Kudos good sir!

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

    I watched so far...

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

    the section about security was a bit of a false dilemma, maybe it might be surprising if you have never heard of ptrace before?

    • @fasterthanlime
      @fasterthanlime  Год назад +2

      Yes, and I'm assuming that the audience for this video hasn't heard of ptrace before (otherwise you won't learn much).
      A lot of folks were surprised re my "Getting food at SNES video games" video that Windows lets you inject DLLs into other processes, so I thought covering the threat model aspect would be a good idea.
      Plus, if it was that trivial, why would Debian have tried switching to the more restrictive setting then had to roll it back? Clearly that's worth spending a couple minutes on :)

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

    Whoa, as a German, it never occurred to me, you could pronounce strace as 'Strasse', but yeah...

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

    im starting to think this guy likes rust

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

    Well now the goal is to upskill myself to understand this.

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

    Your mic looks like an png

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

    You want to play games little fly?

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

    I seem to be the only one, but the music feels a bit too loud to my ears. It sounds like it's competing with your voice, which isn't ideal. Great video otherwise!