linux-audit / audit-kernel

GitHub mirror of the Linux Kernel's audit repository
https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git
Other
140 stars 37 forks source link

RFE: remove audit_log_string() from kernel's internal audit API #84

Closed stevegrubb closed 3 years ago

stevegrubb commented 6 years ago

The function, audit_log_string, is a helper to audit_log_untrustedstring. It cannot be used alone without understanding the rules for untrusted strings. So, any use of it is simply going to be either wrong or will re-invent audit_log_untrustedstring. The current list of files which calls it are:

security/apparmor/ipc.c security/apparmor/audit.c security/apparmor/file.c security/integrity/integrity_audit.c

nefigtut commented 4 years ago

This is a simple audit_log_string() -> audit_log_untrustedstring() replacement. I'm not 100% sure about this. Probably we can leave audit_log_string() in the API and use it for hard-coded obviously fine strings like: audit_log_string(ab, "trace").

The drawback is that some caller still could use audit_log_string() for some untrusted string in the future.

rgbriggs commented 4 years ago

Post v2 https://www.redhat.com/archives/linux-audit/2020-July/msg00008.html https://lkml.org/lkml/2020/7/3/669

rgbriggs commented 4 years ago

kernel test robot generated two warnings: security/apparmor/ipc.c:39:1: warning: non-void function does not return a value in all control paths [-Wreturn-type] security/apparmor/ipc.c:153:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]

Post v3 https://www.redhat.com/archives/linux-audit/2020-July/msg00012.html https://lkml.org/lkml/2020/7/3/875

rgbriggs commented 3 years ago

This can be closed since it is upstream in v5.9-rc1 f1d9b23cabc6 audit: purge audit_log_string from the intra-kernel audit API