Closed pcmoore closed 8 years ago
Looking at this a bit more, we should be doing a strncpy_from_user() at the top of audit_log_single_execve_arg() and the operating only from that copied buffer. In addition to resolving this issue, it should simplify the code quite a bit.
It turns out there are a number of problems with the existing code in audit_log_single_execve_arg(), more than I care to mention here. I'm working on a patch and will update this issue tracker when I have something significant to report.
Quick update: I have a patch which rewrites audit_log_single_execve_arg() to remove the double fetch and fix all the other problems I've found, but it needs some testing to make sure all the corner cases are covered properly.
Issue tracker for the necessary test: https://github.com/linux-audit/audit-testsuite/issues/25
Initial draft fix: https://gist.github.com/pcmoore/5f259b644ca923d1634d87747a2d2cdb
UPDATE: see below for the proper, tested fix
Patch posted upstream: https://www.redhat.com/archives/linux-audit/2016-July/msg00120.html
A test kernel for Fedora Rawhide can be found here:
Merged to audit#next via 43761473c254b45883a64441dd0bc85a42f3645c.
See the mailing list thread below for information:
Taken from the original report: