)]}'
{
  "commit": "b212921b13bda088a004328457c5c21458262fe2",
  "tree": "8f937df8b01f1ea7e13bf8bb87d6ca26190e5b56",
  "parents": [
    "7cdb85df6061d001fffd09c6adfbcf20356615e2"
  ],
  "author": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Sun Oct 06 13:53:27 2019 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Sun Oct 06 13:53:27 2019 -0700"
  },
  "message": "elf: don\u0027t use MAP_FIXED_NOREPLACE for elf executable mappings\n\nIn commit 4ed28639519c (\"fs, elf: drop MAP_FIXED usage from elf_map\") we\nchanged elf to use MAP_FIXED_NOREPLACE instead of MAP_FIXED for the\nexecutable mappings.\n\nThen, people reported that it broke some binaries that had overlapping\nsegments from the same file, and commit ad55eac74f20 (\"elf: enforce\nMAP_FIXED on overlaying elf segments\") re-instated MAP_FIXED for some\noverlaying elf segment cases.  But only some - despite the summary line\nof that commit, it only did it when it also does a temporary brk vma for\none obvious overlapping case.\n\nNow Russell King reports another overlapping case with old 32-bit x86\nbinaries, which doesn\u0027t trigger that limited case.  End result: we had\nbetter just drop MAP_FIXED_NOREPLACE entirely, and go back to MAP_FIXED.\n\nYes, it\u0027s a sign of old binaries generated with old tool-chains, but we\ndo pride ourselves on not breaking existing setups.\n\nThis still leaves MAP_FIXED_NOREPLACE in place for the load_elf_interp()\nand the old load_elf_library() use-cases, because nobody has reported\nbreakage for those. Yet.\n\nNote that in all the cases seen so far, the overlapping elf sections\nseem to be just re-mapping of the same executable with different section\nattributes.  We could possibly introduce a new MAP_FIXED_NOFILECHANGE\nflag or similar, which acts like NOREPLACE, but allows just remapping\nthe same executable file using different protection flags.\n\nIt\u0027s not clear that would make a huge difference to anything, but if\npeople really hate that \"elf remaps over previous maps\" behavior, maybe\nat least a more limited form of remapping would alleviate some concerns.\n\nAlternatively, we should take a look at our elf_map() logic to see if we\nend up not mapping things properly the first time.\n\nIn the meantime, this is the minimal \"don\u0027t do that then\" patch while\npeople hopefully think about it more.\n\nReported-by: Russell King \u003clinux@armlinux.org.uk\u003e\nFixes: 4ed28639519c (\"fs, elf: drop MAP_FIXED usage from elf_map\")\nFixes: ad55eac74f20 (\"elf: enforce  MAP_FIXED on overlaying elf segments\")\nCc: Michal Hocko \u003cmhocko@suse.com\u003e\nCc: Kees Cook \u003ckeescook@chromium.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ad4c6b1d5074aa9cab8de782d000433f3410a778",
      "old_mode": 33188,
      "old_path": "fs/binfmt_elf.c",
      "new_id": "c5642bcb6b468f9ed4e4fe2ff7012eb4fe024f9f",
      "new_mode": 33188,
      "new_path": "fs/binfmt_elf.c"
    }
  ]
}
