[llvm] r322029 - Fix uninitialized read error reported by MSAN.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 14:36:38 PST 2018


Yea, already looking.  Thanks!

On Mon, Jan 8, 2018 at 2:30 PM Evgenii Stepanov <eugeni.stepanov at gmail.com>
wrote:

> It looks like this change broke some other tests:
> --
> YAML:104:11: error: not a mapping
>           - Kind:            S_LOCAL
>           ^
> yaml2obj: Failed to parse YAML file!
>
>
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/12314/steps/check-lld%20msan/logs/stdio
>
> On Mon, Jan 8, 2018 at 1:38 PM, Zachary Turner via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Author: zturner
> > Date: Mon Jan  8 13:38:50 2018
> > New Revision: 322029
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=322029&view=rev
> > Log:
> > Fix uninitialized read error reported by MSAN.
> >
> > The problem was that our Obj -> Yaml dumper had not been taught
> > to handle certain types of records.  This meant that when I
> > generated the test input files, the records were still there but
> > none of its fields were filled out.  So when it did the
> > Yaml -> Obj conversion as part of the test, it generated records
> > with garbage in them.
> >
> > The patch here fixes the Obj <-> Yaml converter, and additionally
> > updates the test file with fresh Yaml generated by the fixed
> > converter.
> >
> > Modified:
> >     llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
> >
> > Modified: llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp?rev=322029&r1=322028&r2=322029&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp (original)
> > +++ llvm/trunk/lib/ObjectYAML/CodeViewYAMLSymbols.cpp Mon Jan  8
> 13:38:50 2018
> > @@ -40,6 +40,7 @@ using namespace llvm::CodeViewYAML::deta
> >  using namespace llvm::yaml;
> >
> >  LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(TypeIndex)
> > +LLVM_YAML_IS_SEQUENCE_VECTOR(LocalVariableAddrGap)
> >
> >  // We only need to declare these, the definitions are in
> CodeViewYAMLTypes.cpp
> >  LLVM_YAML_DECLARE_SCALAR_TRAITS(APSInt, QuotingType::None)
> > @@ -181,6 +182,24 @@ void ScalarEnumerationTraits<FrameCookie
> >  }
> >
> >  namespace llvm {
> > +namespace yaml {
> > +template <> struct MappingTraits<LocalVariableAddrRange> {
> > +  static void mapping(IO &io, LocalVariableAddrRange &Range) {
> > +    io.mapRequired("OffsetStart", Range.OffsetStart);
> > +    io.mapRequired("ISectStart", Range.ISectStart);
> > +    io.mapRequired("Range", Range.Range);
> > +  }
> > +};
> > +template <> struct MappingTraits<LocalVariableAddrGap> {
> > +  static void mapping(IO &io, LocalVariableAddrGap &Gap) {
> > +    io.mapRequired("GapStartOffset", Gap.GapStartOffset);
> > +    io.mapRequired("Range", Gap.Range);
> > +  }
> > +};
> > +} // namespace yaml
> > +} // namespace llvm
> > +
> > +namespace llvm {
> >  namespace CodeViewYAML {
> >  namespace detail {
> >
> > @@ -353,32 +372,50 @@ template <> void SymbolRecordImpl<LocalS
> >  }
> >
> >  template <> void SymbolRecordImpl<DefRangeSym>::map(IO &IO) {
> > -  // TODO: Print the subfields
> > +  IO.mapRequired("Program", Symbol.Program);
> > +  IO.mapRequired("Range", Symbol.Range);
> > +  IO.mapRequired("Gaps", Symbol.Gaps);
> >  }
> >
> >  template <> void SymbolRecordImpl<DefRangeSubfieldSym>::map(IO &IO) {
> > -  // TODO: Print the subfields
> > +  IO.mapRequired("Program", Symbol.Program);
> > +  IO.mapRequired("OffsetInParent", Symbol.OffsetInParent);
> > +  IO.mapRequired("Range", Symbol.Range);
> > +  IO.mapRequired("Gaps", Symbol.Gaps);
> >  }
> >
> >  template <> void SymbolRecordImpl<DefRangeRegisterSym>::map(IO &IO) {
> > -  // TODO: Print the subfields
> > +  IO.mapRequired("Register", Symbol.Hdr.Register);
> > +  IO.mapRequired("MayHaveNoName", Symbol.Hdr.MayHaveNoName);
> > +  IO.mapRequired("Range", Symbol.Range);
> > +  IO.mapRequired("Gaps", Symbol.Gaps);
> >  }
> >
> >  template <> void SymbolRecordImpl<DefRangeFramePointerRelSym>::map(IO
> &IO) {
> > -  // TODO: Print the subfields
> > +  IO.mapRequired("Offset", Symbol.Offset);
> > +  IO.mapRequired("Range", Symbol.Range);
> > +  IO.mapRequired("Gaps", Symbol.Gaps);
> >  }
> >
> >  template <> void SymbolRecordImpl<DefRangeSubfieldRegisterSym>::map(IO
> &IO) {
> > -  // TODO: Print the subfields
> > +  IO.mapRequired("Register", Symbol.Hdr.Register);
> > +  IO.mapRequired("MayHaveNoName", Symbol.Hdr.MayHaveNoName);
> > +  IO.mapRequired("OffsetInParent", Symbol.Hdr.OffsetInParent);
> > +  IO.mapRequired("Range", Symbol.Range);
> > +  IO.mapRequired("Gaps", Symbol.Gaps);
> >  }
> >
> >  template <>
> >  void SymbolRecordImpl<DefRangeFramePointerRelFullScopeSym>::map(IO &IO)
> {
> > -  // TODO: Print the subfields
> > +  IO.mapRequired("Register", Symbol.Offset);
> >  }
> >
> >  template <> void SymbolRecordImpl<DefRangeRegisterRelSym>::map(IO &IO) {
> > -  // TODO: Print the subfields
> > +  IO.mapRequired("Register", Symbol.Hdr.Register);
> > +  IO.mapRequired("Flags", Symbol.Hdr.Flags);
> > +  IO.mapRequired("BasePointerOffset", Symbol.Hdr.BasePointerOffset);
> > +  IO.mapRequired("Range", Symbol.Range);
> > +  IO.mapRequired("Gaps", Symbol.Gaps);
> >  }
> >
> >  template <> void SymbolRecordImpl<BlockSym>::map(IO &IO) {
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180108/0e097e2b/attachment.html>


More information about the llvm-commits mailing list