<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 22, 2016 at 10:33 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Mar 22, 2016 at 1:29 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Mar 22, 2016 at 9:19 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Mar 22, 2016 at 1:15 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Mar 22, 2016 at 9:00 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Mar 22, 2016 at 12:36 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Mar 22, 2016 at 7:36 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I have a question. If there is a ELF verifier function that walks every part of an ELF file to verify that the file is sane, and if you can call that before calling LLD's function, are you guys happy with that?</div></blockquote><div><br></div></span><div>I'd like to get you guys opinion on this question.</div></div></div></div></blockquote><div><br></div></span><div>I'd still find it problematic that lld itself would consider crash-on-invalid "not a bug" to the point of not reviewing/approving patches to fix such issues. That's what I'm concerned about in this thread.</div></div></div></div></blockquote><div><br></div></span><div>That's one way to see that. The other view is it as a whole has a boolean option <i>IsInputTrustworthy</i> and works accordingly. What matters most is what we provide to the users as a guarantee.  You have an opinion that that should be implemented within LLD, but that would now an internal design choice. Hypothetically we had such pass to verify inputs, and if you send a patch to "fix" crash bug of LLD, we wouldn't probably reject that but instead argue that that needs to be addressed in the verifier pass instead. This is about "how" something should be implemented and usual design choice discussion, no?</div></div></div></div></blockquote><div><br></div></span><div>OK, sorry - some confusion. I assume that you wouldn't run this verifier pass by default in lld-the-command-line-tool, right? (I would guess it wouldn't meet your performance criteria)<br></div></div></div></div></blockquote><div><br></div></span><div>Correct.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>So from that perspective, lld-the-command-line-tool would still be crashing-by-design on certain inputs in its default/normal/user-facing mode & that would be seem problematic to me.<br></div></div></div></div></blockquote><div><br></div></span><div>I disagree. You are in almost all case handling valid object files created by compilers, and if omitting some error checks for really pathetic case would make code simpler and improve performance, I think having that option is worth it (and I believe that's the case, at least those who are actually writing code seems to take that stance.) Also, if you give broken object files, you wouldn't get an output anyways. The only difference that a user can observe is whether it dies with an error message or not. We could even catch an segfault and run the verifier on the input again to print out an error after something goes wrong.</div></div></div></div></blockquote><div><br></div></span><div>Sure, I understand that we disagree here, I was merely answering your question "I have a question. If there is a ELF verifier function that walks every part of an ELF file to verify that the file is sane, and if you can call that before calling LLD's function, are you guys happy with that?" to help you understand that point of disagreement/my position (& probably the position of other people on this thread)<br></div></div></div></div></blockquote><div><br></div><div>Yes, I understand that this is where we disagree. LLD is robust in my definition and we are vigorously trying to make it so. To me, however, it is unfortunate but acceptable if LLD crashes on a malicious, hand-crafted object file which is intended to crash LLD if the cost of fixing it is too expensive. I understand a number of people are concerned about the design choices. If the LLVM foundation or whatever wants to say that all LLVM projects must have these minimum standards, and those standards include this design choice, we'd do that. But that does not seems to be the case right now.</div><div><br></div><div>I'd be happy if we could handle all possible errors elegantly with very low overhead, but there seems to be no easy way to do that. We may not have just found it yet. If you come up with a solution and send us a patch, we can discuss that, but what is happening here is that a number of people who are thinking that our design choice is unreasonable are not contributing to the project, so we are repeating the same discussion.</div><div><br></div><div>The reason why I asked that question is it is guaranteed that we can provide a protection for those who wants a 100% crash-free-ness (although I doubt about how effective it is from the user's point of view compared to other components which have crash bugs as discussed in the thread.) People who are in this thread seem to believe that the design choice is not irreversible or will reach to a point where it is irreversible because we will have written too much code with the design, so we won't be able to "fix" any crash "bugs" in future. That is not the case. We can at least provide a new pass anytime to rigorously check any user input. Whether it needs to be a separate pass or integrated one is a detailed design choice that needs a first-hand knowledge on the code base. I also strongly disagree that it will become irreversible as we write more code. It is plainly wrong. We are doing large incremental refactoring pretty often (I'm the person who are doing it most often), and if you come up with a way to handle every possible errors elegantly with very low overhead, we could do that as well.</div><div><br></div><div>Given that, I think you are worrying too much about one design choice that I made. If you need a linker which never crash (whatever it means), then I'm sorry but LLD may not be your choice at least at this moment. It is however probably not suitable for your purpose anyways because it's too early to use -- we are energetically working on implementing missing features<i>. </i>If you have a suggestion to expand its scope without sacrificing usability in other fields, we'd be happy to discuss that.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>(UB is more than just segfaulting, though. So there are more possible failures (including silently producing output & exiting with 0) than segfault.)<span><font color="#888888"><br><br>- David</font></span></div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>If you're proposing having this verifier run by default - sure, then I can't construct an input that crashes the linker, it'll fail with an error message an exit. Yes, that would be fine by me - the way the feature is implemented is not something I mean to imply constraints on.<span><font color="#888888"><br><br>- David</font></span></div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 22, 2016 at 6:39 PM, Hal Finkel via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:rgb(0,0,0)"><br><hr><blockquote style="border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From: </b>"David Blaikie via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br><b>To: </b>"Rafael Espíndola" <<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>><span><br><b>Cc: </b>"llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>, "Bruce Hoult" <<a href="mailto:bruce@hoult.org" target="_blank">bruce@hoult.org</a>><br></span><b>Sent: </b>Tuesday, March 22, 2016 10:18:03 AM<span><br><b>Subject: </b>Re: [llvm-dev] Need help with code generation<br><br></span><div dir="ltr"><br><div class="gmail_extra"><br><span><div class="gmail_quote">On Tue, Mar 22, 2016 at 4:27 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span>> Maybe not, but it's not impossible either - browsers manage to harden themselves against malicious input and they operate in a far hostile environment with many more input formats than we do.<br>
<br>
</span>It is important to note how different they are. Both Firefox and<br>
Chromium have people working just to try to make them more secure.<br>
Compare that with LLVM: One week ago I pointed out that your patch<br>
(r263521) introduces a crash. It still hasn't been reverted or even<br>
acknowledge yet.<br>
<span><br>
<br>
> I'm not trying to shift your personal goal, or to direct the features that you choose to put your time into, but I am interested in project policy.<br>
<br>
</span>Why do you care about policy that is not followed? A policy saying<br>
llvm should not crash on any input is as relevant as one that says<br>
that clang should keep bootstrapping in under one second.<br></blockquote><div><br></div><div>It's pretty different when you say, essentially, that patches to address these things are unlikely to be accepted. It doesn't seem surprising that people wouldn't try to provide those patches and would choose not to use the project if that's the expressed policy of the developers on the project and doesn't line up with the needs of other people.</div></div></span></div></div></blockquote><br>+1<br><br> -Hal<span><br><br><blockquote style="border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
So, if we stick to reality, what we have is that lld (ELF and COFF)<br>
are already the most reliable parts of the toolchain. If not for Rui<br>
and I being upfront about it most people would not even know that you<br>
could crash it. So please, just let us keep working on the most<br>
reliable part of the toolchain.<br>
<div><div><br>
Cheers,<br>
Rafael<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div></div>
<br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></blockquote><br><br><br></span><span>-- <br><div><span name="x"></span>Hal Finkel<br>Assistant Computational Scientist<br>Leadership Computing Facility<br>Argonne National Laboratory<span name="x"></span><br></div></span></div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>