This reverts commit 03d1571d9513369c17e6848476763ebbd10ec2cb.
While /sys/kernel/debug/acpi/custom_method is already a privileged-only
API providing proxied arbitrary write access to kernel memory[1][2],
with existing race conditions[3] in buffer allocation and use that could
lead to memory leaks and use-after-free conditions, the above commit
appears to accidentally make the use-after-free conditions even easier
to accomplish. ("buf" is a global variable and prior kfree()s would set
buf back to NULL.)
This entire interface needs to be reworked (if not entirely removed).
[1] https://lore.kernel.org/lkml/20110222193250.GA23913@xxxxxxxxxxx/
[2] https://lore.kernel.org/lkml/201906221659.B618D83@keescook/
[3] https://lore.kernel.org/lkml/20170109231323.GA89642@beast/
Cc: Wenwen Wang <wenwen@xxxxxxxxxx>
Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---