)]}'
{
  "commit": "731ece41fb1047816303295a0cdfed90a528137e",
  "tree": "432d7a12f14d6ca02fe139ed305c128885847de3",
  "parents": [
    "a3ba81131aca243bfecfa78c42edec0cd69f72d6"
  ],
  "author": {
    "name": "Olof Johansson",
    "email": "olof@lixom.net",
    "time": "Fri Dec 10 02:09:23 2010 -0600"
  },
  "committer": {
    "name": "Michal Marek",
    "email": "mmarek@suse.cz",
    "time": "Tue Dec 28 00:22:58 2010 +0100"
  },
  "message": "modpost: Fix address calculation in reloc_location()\n\nThis patch fixes a segfault in modpost that is observed when the gold\nlinker is used to link the input objects.\n\nThe problem is that reloc_location (modpost.c) is computing the\naddress of the relocation target incorrectly. Here, elf-\u003ehdr points\nto the beginning of the ELF file in memory, sechdr points to the\nrelocation section header, section is the index of the section\nbeing relocated, and sechdrs[section].sh_offset would be the offset\nof that section, relative to the beginning of the ELF file. Adding\nelf-\u003ehdr + sechdrs[section].sh_offset gives you the address of the\nbeginning of the section, and adding r-\u003er_offset to that gives you the\naddress of the location to be relocated. You do not need to subtract\nsechdrs[section].sh_addr from that -- the result of this is an address\noutside the file, and causes the segfault when addend_386_rel tries to\ndereference it.\n\nThis bug is not observed when GNU ld is used to link the inputs. The\nobject file ubuntu/omnibook/omnibook.o is the result of an ld -r of\nseveral other files.  When GNU ld does an ld -r, it sets the vaddr\nfield for each section to 0, but gold lays out the section addresses\nsequentially instead:\n\nSection Headers:\n [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al\n [ 0]                   NULL            00000000 000000 000000 00      0   0  0\n [ 1] .text             PROGBITS        00000000 000034 004794 00  AX  0   0  4\n [ 2] .data             PROGBITS        0000b9d0 0047c8 0009c0 00  WA  0   0  4\n [ 3] .bss              NOBITS          000162f8 005188 00013c 00  WA  0   0  4\n [ 4] .rodata.str1.1    PROGBITS        00004f2d 0052c4 001b1a 01 AMS  0   0  1\n [ 5] .init.text        PROGBITS        00004794 006dde 0005fa 00  AX  0   0  1\n [ 6] .exit.text        PROGBITS        00004d8e 0073d8 00018a 00  AX  0   0  1\n  ...\n\nSo the bug in the tool remained undiscovered because the section\u0027s vaddr\nalways happened to be 0.\n\nSigned-off-by: Raymes Khoury \u003craymes@google.com\u003e\nSigned-off-by: Olof Johansson \u003colof@lixom.net\u003e\nSigned-off-by: Michal Marek \u003cmmarek@suse.cz\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "194e2c4536091c4203750f3058a0975e1e4ff1c8",
      "old_mode": 33188,
      "old_path": "scripts/mod/modpost.c",
      "new_id": "97d2259ae999b6b7f99f709035b49b6e04e88480",
      "new_mode": 33188,
      "new_path": "scripts/mod/modpost.c"
    }
  ]
}
