[Lldb-commits] [PATCH] D144904: [Linux] Add kernel.yama.ptrace_scope note when ptrace fails to attach.

Jordan Rupprecht via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 27 12:07:04 PST 2023


rupprecht created this revision.
rupprecht added reviewers: jingham, DavidSpickett, labath.
Herald added a project: All.
rupprecht requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

A common reason for LLDB failing to attach to an already-running process on Linux is the Yama security module: https://www.kernel.org/doc/Documentation/security/Yama.txt. This patch adds an explaination and suggested fix when it detects that case happening.

This was previously proposed in D106226 <https://reviews.llvm.org/D106226>, but hasn't been updated in a while. The last request was to put the check in a target-specific location, which is the approach this patch takes. I believe Yama only exists on Linux, so it's put in that package.

This has no end-to-end test because I'm not sure how to set `ptrace_scope` in a test environment -- if there are suggestions on how to do that, I'd be happy to add it. (Also, setting it to `3` is comically irreversible). I tested this locally.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144904

Files:
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Linux/Procfs.cpp
  lldb/source/Plugins/Process/Linux/Procfs.h
  lldb/unittests/Process/Linux/ProcfsTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144904.500869.patch
Type: text/x-patch
Size: 5238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230227/21c13b82/attachment.bin>


More information about the lldb-commits mailing list