apoos-maximus added a comment.

In D106226#2891107 <https://reviews.llvm.org/D106226#2891107>, @teemperor wrote:

> Also I wonder how we could make sure we emit this diagnostic in cases where 
> the ptrace_scope is actually the reason for the failed attach. The proper way 
> to check this seems to be checking the errno after we call ptrace and then 
> propagate the error all the way back to lldb from lldb-server. From the lldb 
> side I don't think we have any way of knowing why the attach actually failed 
> so we would emit this error speculatively which doesn't seem ideal.



In D106226#2891565 <https://reviews.llvm.org/D106226#2891565>, @rupprecht wrote:

> Can we have LLDB read the value of /proc/sys/kernel/yama/ptrace_scope, and 
> only print the error if the file exists and is not 0?

Reading the value of `/proc/sys/kernel/yama/ptrace_scope` is possible even when 
running as a non-root user, so user permissions would not pose a problem here.

  [apoos_maximus@host]$ sysctl kernel.yama.ptrace_scope       
  kernel.yama.ptrace_scope = 1
  [apoos_maximus@host]$ cat /proc/sys/kernel/yama/ptrace_scope       
  1

I will check into the ptrace-API to see if there is a direct way for this, else 
look into some other kernel call through which we can read this value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106226/new/

https://reviews.llvm.org/D106226

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to