237 pointsby todsacerdoti7 days ago10 comments
  • chc47 days ago
    Going for the pipe spray is a kinda weird technique, and I'm honestly surprised that it worked. Usually just the fact that you are able to spray over the allocation at all isn't enough, and you also have to worry about your sprayed data containing additional pointers or things that also have to be valid.

    I probably would have gone for turning the UaF into an type confusion style attack: if you spray more sockets you'll end up with two files, the original and the new one, that have aliased sk members, but the vsock code will incorrectly cast the new one to a `vsock_sock`. From there you can probably find some other socket type that puts controllable data over some field that vsock treats as a pointer or vice versa, and use it as both a kaslr leak and data-only r/w primitive.

    • benwilber07 days ago
      > I probably would have gone for turning the UaF into an type confusion style attack

      I'm aware that Linux is nearly 40 years old at this point, and C is even decades older. But it is mind-boggling to me that we're still talking about UAFs and jumping from dangling pointers to get privileged executions in the 21st century.

      (rewrite it in Rust)

      • pjmlp6 days ago
        That was obvious to C.A.R Hoare in 1980, should have been obvious to the industry after the Morris worm in 1988, yet here we are, zero improvements to the ISO C standard in regards to prevent exploits in C code.
        • musicale5 days ago
          Multics (written in PL/I) didn't suffer from buffer overflows. Ada was (and is) memory safe. Pascal had (and still has) range checks and bounded strings.

          But we do have -fbounds-safety in clang (at least on macOS).

      • snarf_br6 days ago
        What's stopping you from doing just that? Looking forward to your linux-rust kernel.
      • 7 days ago
        undefined
      • enigma1016 days ago
        Never if anything remove Rust from linux!
      • Ygg27 days ago
        Nonsense, the C guy told me those happen to people that make mistakes, and that he, being the offspring of the Elemental of Logic, and "Hyperspace cybernetic intelligence and juvenile delinquent John Carmack" is completely immune to such pathetic issues. He works at Linux. Yes, all of Linux.
        • uecker7 days ago
          Yes, we need a languages that makes it impossible. But how could this happen in Rust? https://github.com/advisories/GHSA-5gmm-6m36-r7jh But clearly, this does not count because it used "unsafe", so it remains the programmer's fault who made a mistake. Oh wait, doesn't this invalidate your argument?
          • mkj6 days ago
            A random 16 star github repo using unsafe doesn't really tell anyone much.
          • Ygg27 days ago
            > Oh wait, doesn't this invalidate your argument?

            Not really. If you can't be perfect, at least be good.

            Unless you want to make an argument that searching all of your code base for UB is better than running on a relatively small subset (20-30%).

            Or that Linux should use tracing GC + value types. Which I would find decent as well. But sadly LKML would probably disagree with inclusion of C# (or Java 35).

            • uecker6 days ago
              You can't be perfect. The question is how much improvement "rewriting in Rust" actually brings, how important that is, and what downsides it may have.
              • throwawayqqq116 days ago
                Another, way more impertant question is, can we keep maintaining legacy C code in community driven FOSS projects, when the world moves on.
                • uecker6 days ago
                  Does the world really move on? I think HN could be misleading here. And is moving to evermore complex solution the right answer to mainentance problems? I doubt it.
            • eru6 days ago
              If you really want, you could write your code in Agda or similar and prove it correct. See also seL4 https://github.com/seL4/seL4 which is a proven correct kernel.

              https://sel4.systems/Verification/proofs.html

              • uecker6 days ago
                ... written in C.
                • eru6 days ago
                  It's written in C in the same way it's written in assembly:

                  C is just used as part of the process to go from a high level spec to executable code.

                  You can also compile eg Haskell via C.

                  The subset of C used in seL4 is highly constrained.

                • johnnyjeans6 days ago
                  a subset of C is provable, and is the de-facto standard in the industry.

                  what is it with rust people and thinking robust, automatic correctness checking was invented in the last 20 years?

                  • Ygg26 days ago
                    Wow, the Linux kernel must be full of dunces that rather than writing in proven correct C, added another language that other maintainers hate. What morons! /sarcasm

                    Disclaimer: above is sarcasm, while I don't think Linux Kernel Maintainers are perfect, I don't consider them dunces either. If they can't avoid writing UAF (use after free) or DF (Double free) bugs then what hope does the average C programmer has?

                    • johnnyjeans5 days ago
                      I'm not sure what you're even trying to say. Do you think that formally verified C isn't a thing? Because it's not used in Linux?

                      Linux isn't designed to be formally verifiable. For all of the manpower and resources dedicated to it, it's still bidden to the technical debt of being a 30 year old hobbyist experiment at its core. If you want a formally verified, secure kernel that wasn't written by a college student to see if he could, seL4 exists.

                      • Ygg24 days ago
                        > Do you think that formally verified C isn't a thing? Because it's not used in Linux?

                        No. It exists but is it practical to be used in an OS? From what I gathered from HN, sel4 is very limited in scope and extending that to a semi-usable OS (that uses ""proven"" C) is expensive time and money wise.

                        > still bidden to the technical debt of being a 30 year old hobbyist experiment

                        Citation needed. I admit it has limitations but it's not like the biggest corps in the world aren't working on it.

                        See: https://news.ycombinator.com/item?id=43452185#43454498 https://news.ycombinator.com/item?id=43853283

                        • johnnyjeans4 days ago
                          > sel4 is very limited in scope and extending that to a semi-usable OS (that uses ""proven"" C) is expensive time and money wise.

                          Everything that has to meet a high criteria of safety is like this, yes. For the exact same reason unsafe exists in Rust and completely inescapable, because automatic correctness checking beyond the most trivial static analysis doesn't actually come for free, and it imposes intense design restrictions that make a lot of things very time consuming to do.

                          > Citation needed

                          https://groups.google.com/g/comp.os.minix/c/dlNtH7RRrGA/m/Sw...

                          You will never find a single point in the multiple archives of Linux's git history where a clean break point occurred and the kernel was greenfielded with the express intent of replacing its design abstractions with ones more appropriate and ergonomic for formal analysis. If you'd like to express further skepticism, feel free to try and find that moment which never happened.

                          Participation of large, well recognized corporations does not imply the kernel isn't a mess of technical debt. It actually implies worse.

                    • uecker6 days ago
                      While the memory safety issues are a concern, switching to Rust + Unsafe will only reduce but not eliminate those issues and it is unclear whether adding a lot of complexity is actually worth it compared to other efforts to improve memory safety in C.
                      • Ygg25 days ago
                        > switching to Rust + Unsafe will only reduce but not eliminate those issues

                        Except in practice the code written in Rust experiences no safety issues[1].

                        I've seen this argument before a million times it is one part FUD (by making actual memory issues bigger than they are) one part Nirvana fallacy (argments that make so Java isn't memory safe because it will have to call into C).

                        [1] https://storage.googleapis.com/gweb-research2023-media/pubto...

                        > is actually worth it compared to other efforts to improve memory safety in C

                        As I aluded before, I am sure Linux Kernel Maintainers are aware of sel4. Which begs the question, why they didn't do it? It's in C, proves everything, and solves even more than Rust, why isn't it in kernel?

                        I'm going to hazard a guess, the effort of going full proof for something like Linux would be through the roof. You would need lifetime of LKML dedication.

                        • uecker4 days ago
                          Software written in Rust also experiences safety issues. If you believe otherwise, you are delusional. In the end, if you want extremely safe software there is no other way than formal verification. (and then there can still hardware be issues or bugs in the specification)
                          • yusina4 days ago
                            The world is not black-and-white. One can have more or less issues.

                            And the same goes for improving the situation. Stopping the world and rewriting everything is never going to fly. The only viable approach is gradual introduction of safer techniques, be it a language or verification options, that step by step improve things and make the bar of adoption minimal. Nobody is going to get convinced if this is cast as a culture war. The folks annoyed by the status quo need to bring the skeptics along, everything else is doomed to fail (as well-illustrated by all the discussions here).

                          • Ygg24 days ago
                            > Software written in Rust also experiences safety issues.

                            Yes. And?

                            Seatbelts and air bags all experience safety issues, and general public was against them for a very long time. It doesn't mean they don't increase safety. Or that because you could fall into volcano you should abolish seatbelts.

                            How about for start software with no memory errors? How about more XSS and less UAF?

                            Also, not even formal proofs are enough. A smart enough attacker will use the gap between spec and implementation and target those errors.

                            And while I agree we need more formal proofs and invariant oriented software design, those options are even less popular than Haskell.

                            • yusina4 days ago
                              > A smart enough attacker will use the gap between spec and implementation and target those errors.

                              "Formal verification" literally means that the implementation is proven to satisfy the formal specification, so by definition there won't be any gaps. That's the whole point of formal verification.

                              But you have a point in that there will still be gaps -- between specification and intent. That is, bugs in the specification. (Or maybe you mean "specification" to be some kind of informal description? That's closer to intent than an actual specification which in the formal verification world is a formal and rigorous description of the required behavior.) Though those bugs would likely be significantly less prevalent .. at least that's the expectation, since nobody has really been able to do this in the real world.

                              • Ygg24 days ago
                                > "Formal verification" literally means that the implementation is proven to satisfy the formal specification, so by definition there won't be any gaps.

                                To quote Donald Knuth:

                                    "Beware of bugs in the above code; I have only proved it correct, not tried it."
                                
                                Sure but proof itself might have gaps itself. A famous proved implementation of mergesort had a subtle flaw when array size approached usize. They proved it would sort, they didn't prove it won't experience UB. Or maybe you prove it has no UB if there are no hardware errors (there are hardware errors), etc.

                                The unbeatable quantum cryptography was beat in one instance because the attacker abused the properties of detectors to get the signal without alerting either sides of the conversation.

                                https://www.theregister.com/2010/09/01/quantum_crypto_hack/

                                > Or maybe you mean "specification" to be some kind of informal description?

                                I read somewhere that the secret to hacker mindset is that they ignore what the model is, but look at what is actually there. If they behaved as spec writers expected, they would have never been able to break in.

                                Reminds me of a place I worked. The doors were this heavy mass of wood and metal that would unlock with a loud thud (from several huge rods holding it secure). This was done to formally pass some ISO declaration for document security. The thing is any sane robber would just easily bypass the door by breaking the plaster walls on either side.

                                At least we can stop writing code made of plaster for start.

                                • yusina4 days ago
                                  > Sure but proof itself might have gaps itself.

                                  Then it's an incorrect proof. In the pen-and-paper era, that was a thing, but nowadays proofs are machine-checked and don't have "gaps" anymore.

                                  Or your assumptions have a bug. That's exactly what I mean with specifications being potentially flawed, since all assumptions must be baked into the formal specification. If hardware can fail then that must be specified, otherwise it's assumed to not fail ever. This never ends, and that's the whole point here.

                                  I suppose we are trying to say the same thing, just not with the same terminology.

                            • uecker2 days ago
                              >> Software written in Rust also experiences safety issues.

                              > Yes. And?

                              You claimed otherwise.

                • immibis6 days ago
                  Proven correct C
      • uecker7 days ago
        The last version of C is ISO C 23. I also do believe that rewriting in Rust is the best way to address memory safety in legacy C code and not even for new projects, nor do I think that memory safety is the most pressing security problem.
  • mperham7 days ago
    "We’ve Got a Panic!"

    Looks like we've got an encoding issue too.

    • bombcar7 days ago
      I kind of want to trademark †so that ’ is not just mojibake.
      • jdironman7 days ago
        Not sure Musk would let you trademark his kids name. /s
    • aaronmdjones7 days ago
      The server is responding with

          Content-Type: text/html
      
      i.e. no charset field.

      The document itself also lacks a declared character set.

      • drougge7 days ago
        One thing that really annoys me about the HTTP standards is that some older version used to say that text/* without a declared charset was definitely latin-1 (don't remember which version exactly). Then a later version said no, text/* without a declared charset is definitely utf-8. In practice I feel this means they said "not declaring a charset is definitely not ok", but in a way that no one will understand.

        Possibly a newer version that I haven't read fixed how they said that. As long as I don't check I can hope.

    • klysm7 days ago
      I thought this was a joke at corrupting the data intentionally
    • nyanpasu647 days ago
      I'm confused. The page has a HTML5 doctype, and https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/... says that UTF-8 is the only valid encoding for HTML5 documents, yet Firefox interprets the page as Windows-1252 or such until I "Repair Text Encoding". https://webhint.io/docs/user-guide/hints/hint-meta-charset-u... says you're supposed to include a <meta charset="utf-8"> or optionally Content-Type header.
      • shakna7 days ago
        If you don't have a charset set, then you'll get the fallback for IE compatibility.

        You should pretty much always use one.

    • hehbot7 days ago
      this is a panic-corrupted buffer joke
  • klysm7 days ago
    > So I set off on a journey that would lower my GPA and occasionally leave me questioning my sanity

    Amazing! Sacrificing GPA for projects is always a good time

    • anyfoo7 days ago
      I really liked the old German university concept, the one before we just took over Bachelor/Master.

      Throughout my CS studies, I was just collecting "tickets" (very hard to translate the actual word, "Schein"), which basically just attested that you have passed a course. They (often) had a grade on it, but it did not matter. Instead, once in the middle ("pre-diploma") and once at the very end of your time at university, you'd have oral exams. And those determined your grade. To attend them, you needed the right combination of "tickets".

      The glaring downside of this system is that if you had a bad time in those few months of your very final exams, you could screw up your entire grade.

      The upside of it, is that I was free (and encouraged) to pursue whatever I wanted, without each course risking to have an effect on my "GPA". I had way more tickets than I needed in the end, and still time and energy to pursue whatever else I wanted (playing with microcontrollers etc.).

      • eru6 days ago
        > Throughout my CS studies, I was just collecting "tickets" (very hard to translate the actual word, "Schein"), which basically just attested that you have passed a course. They (often) had a grade on it, but it did not matter. Instead, once in the middle ("pre-diploma") and once at the very end of your time at university, you'd have oral exams. And those determined your grade. To attend them, you needed the right combination of "tickets".

        What you are describing was one of the systems they used.

        So at my university (OvG in Magdeburg) they used this system for math, but computer science had written exams.

      • klysm7 days ago
        I had a couple of classes in USA uni that worked quite similarly. The professor said we can take the quizzes if we want, and if we didn't then the later quizzes would constitute more of your grade. The ultimate play was to only take the final quiz.
        • cherryteastain7 days ago
          > The ultimate play was to only take the final quiz.

          This is how a lot of British undergrad courses ('modules') work. One giant exam at the very end determining everything; no quizzes, no problem sheets, no midterms.

          • twic7 days ago
            Modules? We just had six massive exams at the end of three years!
          • wbl7 days ago
            Chicago used to be that way in the long ago times.
      • xen2xen17 days ago
        Would not be a surprise if AI brought this back.
    • dudus7 days ago
      As a teacher once told me.

      "Never let school limit your education"

      • nzeid7 days ago
        For those wondering this is a common paraphrase of Grant Allen and Mark Twain. Here we say "Never let school get in the way of a good education."
      • technothrasher7 days ago
        I learned a ton while at my university. Much of it was outside of my classwork.
    • cperciva7 days ago
      Agreed. My GPA suffered significantly in 1999 when I was writing a web service to help me calculate Pi, but it was absolutely worth it.
    • 7 days ago
      undefined
    • 6 days ago
      undefined
  • grg07 days ago
    Good write-up. I liked your RSA tutorial too: https://hoefler.dev/content/RSA.pdf
  • snvzz7 days ago
    The Linux Kernel has millions of LoCs. There'll always be bugs.

    It's about time to look at a sane design, such as seL4[0].

    https://sel4.systems/About/seL4-whitepaper.pdf

    • tptacek7 days ago
      This is an apples-oranges comparison, unless things have changed drastically since the last time I worked on L4 (about 10 years ago). L4 is very secure and easy to reason about. But that's because it doesn't really do anything. It makes a lot of sense as a platform to build a general purpose OS on, and as a bottom layer for what would otherwise be a unikernel. But you'd run a browser on top of something that itself runs on seL4, not on seL4 itself.
      • kibwen6 days ago
        That's kind of the point, though. Naturally, a consequence of moving functionality out of the kernel and into userspace is that the kernel does less. That means rethinking the idea of how we build software (WRT what an OS means and what a platform API looks like), but on the other hand our current mode of building software is objectively dogshit, so that's no great loss.
    • surajrmal7 days ago
      It's becoming more and more common to use non Linux based hypervisors to isolate workloads where security matters. Isolating applications within a given VM is not seen as important and therefore ditching Linux isn't really necessary. Applications can continue to be written against Linux APIs and we can create isolation domains separately. This is no longer just a server concept as even phones and cars are starting to employ this technique. It has high cost to RAM, but as RAM gets cheaper it's not as big of a deal.
      • fc417fc8027 days ago
        The obvious question is why Linux is so widely used in the first place. I don't think "APIs" is enough to explain it. One obvious answer is the incredibly broad hardware support. Any alternative selected for use as the hypervisor is going to be at a serious disadvantage in that regard.
        • surajrmal7 days ago
          Not necessarily. You can forward a lot of hardware as is to a Linux VM if you have an iommu. It comes down to whether you need multiple VMs to share access to some hardware or not, which is not all that common based on the way the isolation domains work out. This can start to become more challenging when that hardware has shared resources such as clocks, buses, or power rails to manage, but soc makers are likely going to make hardware increasingly easier to work in this modality as customers require it.
    • yencabulator6 days ago
      How many cores does the world's largest seL4-running box have? 4?
    • signa117 days ago
      don’t mind if you do guv.
  • Dwedit7 days ago
    Yay Rop Chains!
  • dang7 days ago
    [stub for offtopicness]
    • cyberpunk7 days ago
      Cool writeup, and you have exceptional taste in fonts.
      • ohc7 days ago
        I can't read the dark blue links on the black background
    • yapyap7 days ago
      The dark blue on black reads absolutely terribly
      • neuronflux7 days ago
        Try the Reader View feature of Firefox.
    • las_balas_tres7 days ago
      For the love of god please change the blue on black text to something more readable
  • 7 days ago
    undefined
  • waltercool7 days ago
    [dead]
  • xyst7 days ago
    yet another "use-after-free" sploit

    Rust for Linux, wen?

    It's a damn shame the current maintainers are so hostile to its adoption that many of the original rust 4 linux folks have left the project.

    • poincaredisk7 days ago
      Counterargument: Linux is almost 35 years old (wow, time flies). Rust for Linux is a project started at the moment of biggest rust hype. It's understandable that the Linux maintainers are wary of introducing too much rust dependence, in case, for example, all the rust people leave in 5 years and current/old maintainers are stuck with it forever
      • Ygg27 days ago
        Counterargument Counterargument: one would think 35 years is enough to work out the memory safety kinks. If C people can't sort it, a new solution needs to be used.

        Not necessarily Rust, but something memory safe. Perhaps Java (if maintenance is that important) :P

        • procaryote6 days ago
          go do it then...
          • Ygg26 days ago
            Because it worked out so well for Rust in Linux?

            Linux issues are not purely technical. There is the social inertia.

            • procaryote6 days ago
              Does social inertia mean "the people actually working on it has opinions about the work they're doing"? Because that seems fine.
              • Ygg26 days ago
                > the people actually working on it has opinions about the work they're doing

                No. They have opinions and take actions to subvert related work. See people literally stopping a presentation to gripe about Rust cultists, or Hellwig throwing a hissy fit because he doesn't like that Rust code is adjacent to his DMA controller.

                This isn't technical discussion, this is Office Politics 104.

                • procaryote5 days ago
                  Not wanting a mix of programming languages in a project is a fairly reasonable opinion for someone to have in many circumstances.

                  If rust is a really good fit for the kernel I imagine people will adapt over time... so far it doesn't seem promising. If the main fear is that you'll end up having to maintain a bunch of rust code, the propensity for the rust people to rage quit doesn't really allay that fear.

                  If no one wants to do the thing you think is obviously better, you might be a misunderstood genius, or you might be wrong.

                  • Ygg25 days ago
                    > Not wanting a mix of programming languages in a project is a fairly reasonable opinion

                    That's a not what happened. Hellwig asked that Rust in Linux guys not write common bindings to his layer but do it per driver.

                    In other words he as DMA code maintainer gets to choose what and how other people use his interfaces for. That's not how interfaces (as in two environments in software interacting ) work.

                    By that logic if he hates Logitech drivers he can sabotage them because he doesn't like how the devices look?

                    > In other words he as DMA code maintainer gets to choose what and how other people use his interfaces for.

                    He as DMA code maintainer choose no Rust code. However he then can't choose to veto Rust code bindings. He could have choosen to have Rust code and that would have given him the veto.

                    https://lore.kernel.org/rust-for-linux/CAHk-=wgLbz1Bm8QhmJ4d...

    • doug7137057 days ago
      Did they start their own project ? Linux is free, just fork it.
      • surajrmal7 days ago
        There are a lot of entities involved that need to be able to work together. Creating a form fractures things and requires all partners to move to said fork. It's far easier to work upstream even with resistance. Anyone who has maintained a long standing Linux fork understands the costs of trying to rebase thousands of patches. There will never be enough of a migration to make it unnecessary to need to rebase.
        • riehwvfbk7 days ago
          "Hey upstream maintainer, let me commit a bunch of code in a language you can't even read. You get to maintain it forever while I get to move on to bigger and better things. I am better that you after all: I know this cool new language and you don't."

          And this didn't go over well. Shocking.

          • seanhunter6 days ago
            That isn't a remotely fair characterization of what the rust for linux team were saying. In particular they committed to maintaining it.

            https://lwn.net/Articles/1006805/

            "We wrote a single piece of Rust code that abstracts the C API for all Rust drivers, which we offer to maintain ourselves".

            I wish that HN as a whole could maintain a respectful and curious tone of debate when these threads come up. Feel like both rust advocates and skeptics could do a lot better.

      • klysm7 days ago
        The 'just' doesn't belong in front of 'fork'.
    • xen2xen17 days ago
      Rust, the new "I use Arch, BTW"
    • 7 days ago
      undefined