@@ -11,7 +11,7 @@ use crate::{LateContext, LateLintPass, LintContext};
1111
1212declare_lint ! {
1313 /// The `invalid_runtime_symbol_definitions` lint checks the signature of items whose
14- /// symbol name is a runtime symbol expected by `core` differs significantly from the
14+ /// symbol name is a runtime symbol expected by `core` or `std` differs significantly from the
1515 /// expected signature (like mismatch ABI, mismatch C variadics, mismatch argument count,
1616 /// missing return type, ...).
1717 ///
@@ -32,7 +32,8 @@ declare_lint! {
3232 /// standard-library facility or undefined behavior may occur.
3333 ///
3434 /// The symbols currently checked are `memcpy`, `memmove`, `memset`, `memcmp`,
35- /// `bcmp` and `strlen`.
35+ /// `bcmp`, `strlen`, as well as the following POSIX symbols: `open`, `read`, `write`
36+ /// `close`, `malloc`, `realloc`, `free` and `exit`.
3637 ///
3738 /// [^1]: https://doc.rust-lang.org/core/index.html#how-to-use-the-core-library
3839 pub INVALID_RUNTIME_SYMBOL_DEFINITIONS ,
@@ -42,7 +43,7 @@ declare_lint! {
4243
4344declare_lint ! {
4445 /// The `suspicious_runtime_symbol_definitions` lint checks the signature of items whose
45- /// symbol name is a runtime symbol expected by `core`.
46+ /// symbol name is a runtime symbol expected by `core` or `std` .
4647 ///
4748 /// ### Example
4849 ///
@@ -62,7 +63,8 @@ declare_lint! {
6263 /// standard-library facility or undefined behavior may occur.
6364 ///
6465 /// The symbols currently checked are `memcpy`, `memmove`, `memset`, `memcmp`,
65- /// `bcmp` and `strlen`.
66+ /// `bcmp`, `strlen`, as well as the following POSIX symbols: `open`, `read`, `write`
67+ /// `close`, `malloc`, `realloc`, `free` and `exit`.
6668 ///
6769 /// [^1]: https://doc.rust-lang.org/core/index.html#how-to-use-the-core-library
6870 pub SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS ,
@@ -73,12 +75,22 @@ declare_lint! {
7375declare_lint_pass ! ( RuntimeSymbols => [ INVALID_RUNTIME_SYMBOL_DEFINITIONS , SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS ] ) ;
7476
7577static EXPECTED_SYMBOLS : & [ ExpectedSymbol ] = & [
78+ // `core` symbols
7679 ExpectedSymbol { symbol : "memcpy" , lang : LanguageItems :: memcpy_fn } ,
7780 ExpectedSymbol { symbol : "memmove" , lang : LanguageItems :: memmove_fn } ,
7881 ExpectedSymbol { symbol : "memset" , lang : LanguageItems :: memset_fn } ,
7982 ExpectedSymbol { symbol : "memcmp" , lang : LanguageItems :: memcmp_fn } ,
8083 ExpectedSymbol { symbol : "bcmp" , lang : LanguageItems :: bcmp_fn } ,
8184 ExpectedSymbol { symbol : "strlen" , lang : LanguageItems :: strlen_fn } ,
85+ // POSIX symbols
86+ ExpectedSymbol { symbol : "open" , lang : LanguageItems :: open_fn } ,
87+ ExpectedSymbol { symbol : "read" , lang : LanguageItems :: read_fn } ,
88+ ExpectedSymbol { symbol : "write" , lang : LanguageItems :: write_fn } ,
89+ ExpectedSymbol { symbol : "close" , lang : LanguageItems :: close_fn } ,
90+ ExpectedSymbol { symbol : "malloc" , lang : LanguageItems :: malloc_fn } ,
91+ ExpectedSymbol { symbol : "realloc" , lang : LanguageItems :: realloc_fn } ,
92+ ExpectedSymbol { symbol : "free" , lang : LanguageItems :: free_fn } ,
93+ ExpectedSymbol { symbol : "exit" , lang : LanguageItems :: exit_fn } ,
8294] ;
8395
8496#[ derive( Copy , Clone , Debug ) ]
0 commit comments