<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Hi Matthias,<br>
    <br>
    On 2024-09-25 15:38, Baesken, Matthias wrote:<br>
    <blockquote type="cite" cite="mid:AM9PR02MB6770740FE683E90D1F345D4893692@AM9PR02MB6770.eurprd02.prod.outlook.com">
      
      <meta name="Generator" content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="en-DE">Hi Stefan, not sure if
            this is the cause of the issue. If I add a check with a
            guarantee and build/run without ubsan<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white">@@
            -46,6 +46,9 @@ bool
            LogSelectionList::verify_selections(outputStream* out) const
            {</span><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D"><br>
            <span style="background:white">       _selections[i].describe_tags_on(out);</span><br>
            <span style="background:white">       out->print(". ");</span><br>
            <span style="background:white"> </span><br>
            <span style="background:white">+ // added - check that the
              array entries are okay</span><br>
            <span style="background:white">+
              _selections[i].check_for_bad_tag_array(i, out);</span><br>
            <span style="background:white">+</span><br>
            <span style="background:white">       _selections[i].suggest_similar_matching(out);</span></span><span lang="en-DE"><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE">I see the large  tag 
            entry values too.</span></p>
      </div>
    </blockquote>
    <br>
    I'm pretty sure the lack of initialization is the problem and I
    don't see how the above shows that claim to be false.<br>
     <br>
    <blockquote type="cite" cite="mid:AM9PR02MB6770740FE683E90D1F345D4893692@AM9PR02MB6770.eurprd02.prod.outlook.com">
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="en-DE"><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE">But initializing the
            whole  _tags  array seems to make sense.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE">What value should we
            write  to the entries  ?</span></p>
      </div>
    </blockquote>
    <br>
    I think we can either set them to LogTag::__NO_TAG, or rely on the
    fact that __NO_TAG is equal to 0 and just add `_ntags()` to the
    intialization list to get the array value initialized (which will
    zero initialize the elements, IIUC).<br>
    <br>
    <blockquote type="cite" cite="mid:AM9PR02MB6770740FE683E90D1F345D4893692@AM9PR02MB6770.eurprd02.prod.outlook.com">
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="en-DE"><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE">And any idea why the
            initialization was not done for some  ?</span></p>
      </div>
    </blockquote>
    <br>
    I added an assert in the LogSelection constructor and it points to:<br>
        LogSelection exact_selection(subsets[i], false, level);<br>
    <br>
    Another example is the LogSelection::LogSelection(). To find the
    exact place in these tests I would recommend using the rr tool to
    reverse debug to the point where _tags[0] was initialized.<br>
    <br>
    Cheers,<br>
    StefanK<br>
    <br>
    <blockquote type="cite" cite="mid:AM9PR02MB6770740FE683E90D1F345D4893692@AM9PR02MB6770.eurprd02.prod.outlook.com">
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="en-DE"><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE">Best regards, Matthias<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-DE"><o:p> </o:p></span></p>
        <p class="MsoNormal"><b><span style="mso-ligatures:none;mso-fareast-language:#2000" lang="EN-US">></span></b><o:p> </o:p></p>
        <p class="MsoNormal" style="margin-bottom:12.0pt">>Isn't the
          problem that the LogSelection constructor doesn't initialize
          all elements (Only elements that are __NO_TAG gets
          initialized):<br>
          >```<br>
          >LogSelection::LogSelection(const LogTagType
          tags[LogTag::MaxTags], bool wildcard, LogLevelType level)<br>
          >    : _ntags(0), _wildcard(wildcard), _level(level),
          _tag_sets_selected(0) {<br>
          >  while (_ntags < LogTag::MaxTags &&
          tags[_ntags] != LogTag::__NO_TAG) {<br>
          >    _tags[_ntags] = tags[_ntags];<br>
          >    _ntags++;<br>
          >  }<br>
          >```<br>
          ><br>
          >And then later when the code copies LogTagType arrays, it
          hits this ubsan warning when it reads the uninitialized
          value.. It looks like this could be fixed by always fully
          initializing _tags memory.<br>
          <br>
          <br>
          <span style="mso-ligatures:none;mso-fareast-language:#2000"><o:p></o:p></span></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>