public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/106003] RFE: -fanalyzer could complain about misuse of file-descriptors
Date: Sat, 02 Jul 2022 16:45:28 +0000	[thread overview]
Message-ID: <bug-106003-4-oTzr9o6kEz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106003-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106003

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Immad Mir <mir@gcc.gnu.org>:

https://gcc.gnu.org/g:97baacba963c06e3d0e33cde04e7e687671e60e7

commit r13-1404-g97baacba963c06e3d0e33cde04e7e687671e60e7
Author: Immad Mir <mirimmad17@gmail.com>
Date:   Sat Jul 2 22:09:37 2022 +0530

    analyzer: implement five new warnings for misuse of POSIX file descriptor
APIs [PR106003].

    This patch adds a new state machine to the analyzer for checking usage of
POSIX file descriptor
    APIs with five new warnings.

    It adds:
    - check for FD leaks (CWE 775).
    - check for double "close" of a FD (CWE-1341).
    - check for read/write of a closed file descriptor.
    - check whether a file descriptor was used without being checked for
validity.
    - check for read/write of a descriptor opened for just writing/reading.

    gcc/ChangeLog:
            PR analyzer/106003
            * Makefile.in (ANALYZER_OBJS): Add sm-fd.o.
            * doc/invoke.texi:  Add -Wanalyzer-fd-double-close,
-Wanalyzer-fd-leak,
            -Wanalyzer-fd-access-mode-mismatch,
-Wanalyzer-fd-use-without-check,
            -Wanalyzer-fd-use-after-close.

    gcc/analyzer/ChangeLog:
            PR analyzer/106003
            * analyzer.opt (Wanalyzer-fd-leak): New option.
            (Wanalyzer-fd-access-mode-mismatch): New option.
            (Wanalyzer-fd-use-without-check): New option.
            (Wanalyzer-fd-double-close): New option.
            (Wanalyzer-fd-use-after-close): New option.
            * sm.h (make_fd_state_machine): New decl.
            * sm.cc (make_checkers): Call make_fd_state_machine.
            * sm-fd.cc: New file.

    gcc/testsuite/ChangeLog:
            PR analyzer/106003
            * gcc.dg/analyzer/fd-1.c: New test.
            * gcc.dg/analyzer/fd-2.c: New test.
            * gcc.dg/analyzer/fd-3.c: New test.
            * gcc.dg/analyzer/fd-4.c: New test.

  parent reply	other threads:[~2022-07-02 16:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 15:21 [Bug analyzer/106003] New: " dmalcolm at gcc dot gnu.org
2022-06-16 15:30 ` [Bug analyzer/106003] " dmalcolm at gcc dot gnu.org
2022-06-19 12:27 ` mir at gcc dot gnu.org
2022-07-02 16:45 ` cvs-commit at gcc dot gnu.org [this message]
2022-07-04  8:50 ` marxin at gcc dot gnu.org
2022-07-04 14:08 ` marxin at gcc dot gnu.org
2022-07-04 14:16 ` mir at gcc dot gnu.org
2022-07-23 17:40 ` dmalcolm at gcc dot gnu.org
2022-07-27 13:58 ` mir at gcc dot gnu.org
2022-08-02 18:03 ` mir at gcc dot gnu.org
2022-10-24 21:00 ` dmalcolm at gcc dot gnu.org
2022-11-03 14:58 ` dmalcolm at gcc dot gnu.org
2022-11-15 19:11 ` dmalcolm at gcc dot gnu.org
2022-11-15 19:13 ` dmalcolm at gcc dot gnu.org
2023-01-10 16:13 ` dmalcolm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106003-4-oTzr9o6kEz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).