Thanks for helping to track down this bug. Since the problem occurs only with a few Linux kernel versions and affects Emacs only when doing CPU profiling, it doesn't seem worth spending time to try to patch Emacs to work around the bug. So I installed the attached patch into emacs-26's etc/PROBLEMS file to warn users about the problem, and am closing the Emacs bug report.