You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/08/03 04:19:12 UTC

[GitHub] [trafficserver] masaori335 opened a new issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

masaori335 opened a new issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198


   - clang version 11.1.0
   - Report: https://ci.trafficserver.apache.org/clang-analyzer/github/8197/2021-08-02-201641-5958-1/
   
   # Timeline
   
   - clang-analyzer reported the issue on the master branch and #7596 removed the `UnixNetVConnection::startEvent` function
   - but it made a crash, #8184 tried to revert the commit with a fix
   - clang-analyzer gave a green light on #8184 https://ci.trafficserver.apache.org/job/clang-analyzer-github/14671/ and we merged it
   - clang-analyzer start reporting the issue on the latest master
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-892378318


   Also, we need to check how the ci job merges PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-892317593


   As @SolidWallOfCode pointed out somewhere, it looks like the clang-analyzer is confused by `void UnixNetVConnection::free(EThread *)` and `void std::free(void *)`. If I changed the name of the function or expand the code (like inline), the report is gone.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 edited a comment on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 edited a comment on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-892264691


   I got repro with llvm-11.1.0 on my mac, I was missing to set `ccc-analyzer` and `c++-analyzer` as compiler.
   ```
   /opt/src/github.com/apache/trafficserver-asf-master/iocore/eventsystem/I_Lock.h:552:7: warning: Use of memory after it is freed [unix.Malloc]
         Mutex_unlock(m, m->thread_holding);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-892264691


   I got repro with llvm-11.1.0 on my mac, I was missing to set `ccc-analyzer ccc-analyzer` and `c++-analyzer ccc-analyzer` as compiler.
   ```
   /opt/src/github.com/apache/trafficserver-asf-master/iocore/eventsystem/I_Lock.h:552:7: warning: Use of memory after it is freed [unix.Malloc]
         Mutex_unlock(m, m->thread_holding);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 closed issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 closed issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-891530689


   hmm, I might be missing something, but my local clang-12 doesn't report this issue
   ```
   » /usr/local/opt/llvm/bin/scan-build --keep-cc -enable-checker alpha.unix.cstring.BufferOverlap -enable-checker alpha.core.BoolAssignment -enable-checker alpha.core.CastSize -enable-checker alpha.core.SizeofPtr --status-bugs --keep-empty make -j16
   scan-build: Using '/usr/local/Cellar/llvm/12.0.0_1/bin/clang-12' for static analysis
   make[1]: Entering directory '/opt/src/github.com/apache/trafficserver-asf-master/iocore/net'
   ...
   scan-build: Analysis run complete.
   scan-build: No bugs found.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 edited a comment on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 edited a comment on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-891530689






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-891535646


   neither with 11.1.0_2
   ```
   » /usr/local/opt/llvm@11/bin/scan-build --keep-cc -enable-checker alpha.unix.cstring.BufferOverlap -enable-checker alpha.core.BoolAssignment -enable-checker alpha.core.CastSize -enable-checker alpha.core.SizeofPtr --status-bugs --keep-empty make -j16
   scan-build: Using '/usr/local/Cellar/llvm@11/11.1.0_2/bin/clang-11' for static analysis
   make[1]: Entering directory '/opt/src/github.com/apache/trafficserver-asf-master/iocore/net'
   ...
   scan-build: Analysis run complete.
   scan-build: No bugs found.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-893016633


   #8209 fixed the report.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-891584859


   The last resort is 
   ```
   #ifndef __clang_analyzer__
   // Code not to be analyzed
   #endif
   ```
   https://clang-analyzer.llvm.org/faq.html#exclude_code


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 commented on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-893016633


   #8209 fixed the report.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 edited a comment on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 edited a comment on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-891530689


   hmm, I might be missing something, but my local clang-12 on macOS doesn't report this issue
   ```
   » /usr/local/opt/llvm/bin/scan-build --keep-cc -enable-checker alpha.unix.cstring.BufferOverlap -enable-checker alpha.core.BoolAssignment -enable-checker alpha.core.CastSize -enable-checker alpha.core.SizeofPtr --status-bugs --keep-empty make -j16
   scan-build: Using '/usr/local/Cellar/llvm/12.0.0_1/bin/clang-12' for static analysis
   make[1]: Entering directory '/opt/src/github.com/apache/trafficserver-asf-master/iocore/net'
   ...
   scan-build: Analysis run complete.
   scan-build: No bugs found.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 closed issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 closed issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 edited a comment on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 edited a comment on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-891535646


   neither with 11.1.0_2 on macOS
   ```
   » /usr/local/opt/llvm@11/bin/scan-build --keep-cc -enable-checker alpha.unix.cstring.BufferOverlap -enable-checker alpha.core.BoolAssignment -enable-checker alpha.core.CastSize -enable-checker alpha.core.SizeofPtr --status-bugs --keep-empty make -j16
   scan-build: Using '/usr/local/Cellar/llvm@11/11.1.0_2/bin/clang-11' for static analysis
   make[1]: Entering directory '/opt/src/github.com/apache/trafficserver-asf-master/iocore/net'
   ...
   scan-build: Analysis run complete.
   scan-build: No bugs found.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 edited a comment on issue #8198: clang-analyzer: use-after-free on ~MutexTryLock

Posted by GitBox <gi...@apache.org>.
masaori335 edited a comment on issue #8198:
URL: https://github.com/apache/trafficserver/issues/8198#issuecomment-892264691


   I got repro with llvm-11.1.0 & 12.0.1 on my mac, I was missing to set `ccc-analyzer` and `c++-analyzer` as compiler.
   ```
   /opt/src/github.com/apache/trafficserver-asf-master/iocore/eventsystem/I_Lock.h:552:7: warning: Use of memory after it is freed [unix.Malloc]
         Mutex_unlock(m, m->thread_holding);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org