[PATCH] D76543: [llvm-dwp] Fix a possible out of bound access.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 03:11:49 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-dwp/X86/unknown-section-id.s:1-8
+## The test checks that llvm-dwp avoids an out of bound access when there is
+## an unknown section identifier in an index section. Without the fix, the test
+## failed when LLVM is built with UBSan.
+## Note that additional sections (.debug_abbrev.dwo, .debug_info.dwo, and
+## .debug_types.dwo) are required to reach the test points in the code.
+
+# RUN: llvm-mc -triple x86_64-unknown-linux-gnu %s -filetype=obj -o %t.dwp
----------------
ikudrin wrote:
> jhenderson wrote:
> > ikudrin wrote:
> > > dblaikie wrote:
> > > > What does llvm-dwp do insteand of out of bounds access? Testing for "does anything other than crash" is usually a bad sign - presumably there's some specific behavior that we'd like llvm-dwp to have in these cases and should be testing for it here.
> > > It just ignores the unknown sections because there is little it can do with them anyway.
> > Could we demonstrate that it does something else after the failure point and also that it doesn't try to dump the unknown sections?
> Nothing comes to my mind. `llvm-dwp` creates the output, as usual. It ignores unknown sections, as usual. The only change is that it does not write to random memory locations, but that is not something that is easy to demonstrate; only UBSan catches that. Do you have any particular suggestions?
Perhaps at least show that the output contains only the expected sections maybe (not their contents)?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76543/new/

https://reviews.llvm.org/D76543





More information about the llvm-commits mailing list