[all-commits] [llvm/llvm-project] a40929: [lldb] Fix cross-platform kills

Pavel Labath via All-commits all-commits at lists.llvm.org
Tue Nov 9 06:31:41 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a40929dcd295997736caf066758dd359216443c2
      https://github.com/llvm/llvm-project/commit/a40929dcd295997736caf066758dd359216443c2
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2021-11-09 (Tue, 09 Nov 2021)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/lldbtest.py
    M lldb/source/Target/Platform.cpp
    A lldb/test/API/functionalities/gdb_remote_client/Makefile
    A lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
    M lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
    A lldb/test/API/functionalities/gdb_remote_client/sleep.cpp

  Log Message:
  -----------
  [lldb] Fix cross-platform kills

This patch fixes an amusing bug where a Platform::Kill operation would
happily terminate a proces on a completely different platform, as long
as they have the same process ID. This was due to the fact that the
implementation was iterating through all known (debugged) processes in
order terminate them directly.

This patch just deletes that logic, and makes everything go through the
OS process termination APIs. While it would be possible to fix the logic
to check for a platform match, it seemed to me that the implementation
was being too smart for its own good -- accessing random Process
objects without knowing anything about their state is risky at best.
Going through the os ensures we avoid any races.

I also "upgrade" the termination signal to a SIGKILL to ensure the
process really dies after this operation.

Differential Revision: https://reviews.llvm.org/D113184




More information about the All-commits mailing list