-
Notifications
You must be signed in to change notification settings - Fork 13.6k
clang-tidy problem on read non-blocking file descriptor #124474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-tidy Author: Davit Petrosyan (dpetrosy)
Hi!
I found some suspicious behavior of clang-tidy(version 19.1.3). When I call read on the non-blocking file descriptor, it reports [clang-analyzer-unix.BlockInCriticalSection]
Here is some example code:
|
@llvm/issue-subscribers-clang-static-analyzer Author: Davit Petrosyan (dpetrosy)
Hi!
I found some suspicious behavior of clang-tidy(version 19.1.3). When I call read on the non-blocking file descriptor, it reports [clang-analyzer-unix.BlockInCriticalSection]
Here is some example code:
|
Ah yes. Thanks for the report. Currently, the logic is really simple: do we call a set of APIs such as "read" while holding a mutex? If so, warn. I don't think we should overcomplicate this, so a suppression should be enough to get rid of this FP. In details:
|
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: Davit Petrosyan (dpetrosy)
Hi!
I found some suspicious behavior of clang-tidy(version 19.1.3). When I call read on the non-blocking file descriptor, it reports [clang-analyzer-unix.BlockInCriticalSection]
Here is some example code:
|
@dpetrosy I am interested to take this issue, I am beginner in LLVM. |
Sounds good. I tried to leave the detailed steps in my previous comment to give you some aid. You should look at other checkers that create custom visitors and look at the git blame when and how they were introduced to get a rough idea what it would take to make one like I described. Likely even chatgpt can do the bulk of the work if you ask it nicely :D And of course, I'm here to help to answer any questions. |
@KHariHaraChaitanya Hi! |
@KHariHaraChaitanya How's it going on this one? Any chance I can help out? Also looking for a first issue in LLVM. |
Hey @sidsabh, I'm still actively working on it. I appreciate your offer and will definitely reach out if I hit any blockers. |
From my perspective, as a maintainer, I'm more interested in the outcomes. The first one having a PR would then drive the discussion, but anyone could chim in. It's a collaborative effort. And as such, it should be asynchronous and outcome driven. |
…BLOCK streams (#127049) this PR close #124474 when calling `read` and `recv` function for a non-block file descriptor or a invalid file descriptor(`-1`), it will not cause block inside a critical section. this commit checks for non-block file descriptor assigned by `open` function with `O_NONBLOCK` flag. --------- Co-authored-by: Balazs Benics <[email protected]>
Hi!
I found some suspicious behavior of clang-tidy(version 19.1.3). When I call read on the non-blocking file descriptor, it reports [clang-analyzer-unix.BlockInCriticalSection]
Here is some example code:
The text was updated successfully, but these errors were encountered: