analyze-security: always save syscall name
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 15 Jun 2022 16:23:20 +0000 (01:23 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 17 Jun 2022 03:37:56 +0000 (12:37 +0900)
commit5862e5561c9bbe87ad201e8d6b2ce2d0f04e7c37
tree412b5f4195704b8b355a38a6a1c7c79df15048f2
parentcb649d12bf3283974305c98ecf51e4bf7596a8bf
analyze-security: always save syscall name

This reverts dd51e725df9aec2847482131ef601e0215b371a0 and fixes bugs
introduced by 1624114d74f55ad9791b7624b08d89d2339a68b3.

Previously,
- On online scan, the syscall filter was a string Hashmap, but it
  might contain syscall name with errno or error action. Hence, we need
  to drop the errno or error action in the string.
- On offline scan, the syscall filter was a Hashmap of syscall ID, so
  hashmap_contains() with syscall name did not work. We need to convert
  syscall IDs to syscall names.
- If hashmap_contains() in syscall_names_in_filter() is true, then
  the syscall is allowed when the list is an allow-list, and vice versa.
  Hence, the condition in syscall_names_in_filter() was errnously
  inverted by dd51e725df9aec2847482131ef601e0215b371a0.

This makes syscalls are always stored with its name, instead of ID,
and also correct the condition.

Fixes #23663.
src/analyze/analyze-security.c