<div dir="ltr"><div><br></div><div>The watermark is intended to detect changes in the loadable image of the binary, not all of the ELF file e.g. ignore debug data. As you've stated, it is there to detect post-link modifications to the loadable segments.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 3, 2019 at 8:46 AM Jon Chesterfield via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">JonChesterfield added a comment.<br>
<br>
In D66426#1761836 <<a href="https://reviews.llvm.org/D66426#1761836" rel="noreferrer" target="_blank">https://reviews.llvm.org/D66426#1761836</a>>, @chrisjackson wrote:<br>
<br>
> A post-link modification could recalculate and update the hash, but this would only occur in a deliberate attempt to subvert the watermark mechanism<br>
<br>
<br>
I think it follows that this patch only detects accidental modifications to the binary that occur after linking. That seems to put is in the realm of network transmission errors, disk bit rot, optical media errors and so forth.<br>
<br>
In which case, why only guard a subset of the binary, instead of computing a sha256 of all the compiled artifacts and checking that at install/network copy time? Then there is again no linker patch required.<br>
<br>
Unless this is intended to catch people who deliberately change the binary, but lack the skills to then update the hash, which is surely vanishingly few people. Fewer when provided with convenient tools to recalculate the hash.<br>
<br>
<br>
CHANGES SINCE LAST ACTION<br>
  <a href="https://reviews.llvm.org/D66426/new/" rel="noreferrer" target="_blank">https://reviews.llvm.org/D66426/new/</a><br>
<br>
<a href="https://reviews.llvm.org/D66426" rel="noreferrer" target="_blank">https://reviews.llvm.org/D66426</a><br>
<br>
<br>
<br>
</blockquote></div>