The one-liner:

dd if=/dev/zero bs=1G count=10 | gzip -c > 10GB.gz

This is brilliant.

  • Aatube
    link
    fedilink
    -1315 days ago

    macOS compresses its memory. Does this mean we’ll see bots running on macOS now?

    • @[email protected]
      link
      fedilink
      English
      21
      edit-2
      15 days ago

      Linux and Windows compress it too, for 10 years or more. And that’s not how you avoid zip bombs, just limit how much you uncompress and abort if it’s over that limit.

      • Aatube
        link
        fedilink
        215 days ago

        All I know is it compresses memory. The mechanism mentioned here for ZIP bombs to crash bots is to fill up memory fast with repeating zeroes.

    • DreamButt
      link
      fedilink
      English
      415 days ago

      No, but that’s an interesting question. Ultimately it probably comes down to hardware specs. Or depending on the particular bot and it’s env the spec of the container it’s running in

      Even with macos’s style of compressing inactive memory pages you’ll still have a hard cap that can be reached with the same technique (just with a larger uncompressed file)

      • @[email protected]
        link
        fedilink
        English
        214 days ago

        How long would it take to be considered an inactive memory page? Does OOM conditions immediately trigger compression, or would the process die first?

        • DreamButt
          link
          fedilink
          English
          114 days ago

          So I’m not an expert but my understanding is the flow is roughly:

          1. Available memory gets low
          2. Compress based on LRU rules
          3. Use swap
          4. OOM

          So it’s more meant to be preventative afaik