<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55906>55906</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `LSAN_OPTIONS=malloc_context_size=1` results in all leaks being supressed
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            compiler-rt:lsan
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sbc100
      </td>
    </tr>
</table>

<pre>
    We ended up patching `LeakSuppressionContext::SuppressInvalid` this in emscripten in order to avoid this issue:

https://github.com/emscripten-core/emscripten/blob/d8f677e301ca8877eae63940b934046f9376059b/system/lib/compiler-rt/lib/lsan/lsan_common.cpp#L186-L195

We advise users to use `LSAN_OPTIONS=malloc_context_size=0` but this bug also effects anyone who sets it to 1.   Basically if we limit the amount of stack frames we collect it causes `GetCallerPC` to return 0 for all leaks which in turn causes all leaks to be suppresed via SuppressInvalid.

While investigating I noticed that LSAN currently sets a lower limit of 1 for `malloc_context_size` (in `FlagParser::parse_flags`)..  I suppose one possible solution to this issue would be to instead set this to 2.. since that is currently minimum required to get any leaks reported.   
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU9tu2zAM_RrnhUgg27ETP_iha7GhQLEV6IA9FrrQsTZZ8nRJ1339KCdd2mEYBhg2L_IRzyEpnHruvyCgVaggzTDzKEdtD1C07A75t4c0zx5D0M5eOxvxRyzqK3pe4rf2yI1WdBriqANoCzgF6fUc0WbPeYUeogN-dFqdD4WQMOOwm4Kd32OMc8ix6j09Bx3HJDbSTeRcANfSeXwTIUcYJ-ij9kO722HNSsn3e7I4tnW3ZaKrt2zbDl29a1nT5aPhOUTMyEZnl26ZtUG_9vF3zARuz59Hyk_ObuQ8F1V9V-7b9V3ZNa-LJwW5OuqAkAL6kOmSsWj4cPXx8dP959tPHx-K-mbixjhJiIuUj0H_JB1uWJZPpHhSR6QDcBMc4DCgjAG4fXYW4Wl0EJB8HfMF5QYA3vGgJWE-gx7gCcHoKWdHqmdyyUZwA4TI5TcYPJ8w5DPSGUO4GUZyKjPkOj9gvCYc9PfXSy8deIzJW2AwOE_1GDA0DgQwajnmxi7ZM8AlTT8KhHCaDhqpo-bwx6xs3ig3kvIEd8QQ9YHHPHq3YF3UEvO08AhZQpDJe7SRiC4ScDDuiebqxJdIlkuZVPrfFCZCRbWnmsl6b_jhnntq02mQ52w_DhQNlC2qbkO63i4MHLUwC09G0ILKDM6kSJuQWV4GGZ5cMirTprC2NFpc5SpPRyhWEWTQVuKJDwUvbCZt9ZQmUvt70j5TdnCgf6nnZ0U9zs5HVLndK9XXqqs7voo6Guz_d8DKLAG1IJm4rOilXwKz4sQ2NwjVKnnT_2MVjTm-fNazd19pjshdZAhkNE3H2tXY81JwJbstDrtyR1bZSNHWTJW7alvLbbcyXKAJfdG8K6rq9f7VV6fNq4rmZqX7ilUVa1lblQ2r2KZt2v1-KNW-EyhqsS22DCeuzSYXtHH-sPL9UhvtUKCk0SGGS5JTHw8WcbmX8HmKo_N9ELJkbLWw6BcKvwDVJLbM">