Commit 81e7614
cfg: add library configuration for libselinux (#6461)
There are a couple false-positives and false-negatives:
- no warning of `ignoredReturnValue` for `get_default_type()`:
```xml
<function name="get_default_type">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
<strz/>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
</function>
<memory>
<alloc init="true" arg="2">get_default_type</alloc>
<dealloc>free</dealloc>
</memory>
```
```c
get_default_type("object_r", type2); // does not report
ignoredReturnValue
```
- wrong `constVariablePointer` report for `selabel_open()`, especially
since the cleanup function `selabel_close()` does take a not pointer to
non-const:
```xml
<function name="selabel_open">
<returnValue type="struct selabel_handle *"/>
<noreturn>false</noreturn>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:5</valid>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
```
```c
struct selabel_handle *hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0); //
reports constVariablePointer
```
- missing `memleak` for `getseuserbyname()`:
```xml
<function name="getseuserbyname">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
<strz/>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="3" direction="out">
<not-null/>
</arg>
</function>
<memory>
<alloc init="true" arg="2">getseuserbyname</alloc>
<dealloc>free</dealloc>
</memory>
<memory>
<alloc init="true" arg="3">getseuserbyname</alloc>
<dealloc>free</dealloc>
</memory>
```
```c
void getseuserbyname_fail2(void)
{
char *seuser, *level;
getseuserbyname("root", &seuser, &level);
free(level);
// seuser is leaked; no memleak report
}
```
---------
Co-authored-by: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Co-authored-by: Oliver Stöneberg <firewave@users.noreply.github.com>1 parent ac5d06c commit 81e7614
6 files changed
Lines changed: 3934 additions & 2 deletions
File tree
- .github/workflows
- cfg
- test
- cfg
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
0 commit comments