[Differential] [Request, 23 lines] D1425: Disallow ptrace on greeter and kwin_wayland process on FreeBSD [... for the future]
tcberner (Tobias C. Berner)
noreply at phabricator.kde.org
Fri Apr 15 17:03:18 UTC 2016
tcberner created this revision.
tcberner added reviewers: rakuco, graesslin.
tcberner set the repository for this revision to rKWIN KWin.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.
REVISION SUMMARY
Similar to[[ https://phabricator.kde.org/D1216 | https://phabricator.kde.org/D1216 ]] add procctl call to disable ptrace on FreeBSD.
We cannot do the procfs-lookup to check whether the process is already being run inside gdb -- however, on FreeBSD, we could use the P_TRACED flag of the process to figure this out:
> sys/proc.h:#define P_TRACED 0x00800 /* Debugged process being traced. */
And the code would look something similar to
pid_t pid = getpid();
struct procstat *prstat = procstat_open_sysctl();
struct kinfo_proc *procinfo;
unsigned int cnt;
procinfo = procstat_getprocs(prstat, KERN_PROC_PID, pid, &cnt);
long p_flags = procinfo->ki_flag;
int p_traced = p_flags & P_TRACED;
if (p_traced != P_TRACED) {
mode = PROC_TRACE_CTL_DISABLE;
procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode);
}
procstat_freeprocs(prstat,procinfo);
procstat_close(prstat);
But as wayland is [far] in the future on FreeBSD, and that check above is a bit lengthy, I think it is enough if we add it once it is needed.
REPOSITORY
rKWIN KWin
REVISION DETAIL
https://phabricator.kde.org/D1425
AFFECTED FILES
CMakeLists.txt
config-kwin.h.cmake
main_wayland.cpp
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: tcberner, rakuco, graesslin
Cc: plasma-devel, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160415/53f05ffd/attachment.html>
More information about the Plasma-devel
mailing list