From 2d738b856d73c9257aabc441f0e8517a9b13c129 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 9 Sep 2020 17:20:13 +0300 Subject: [PATCH] launcher-direct: warn when opening devices non-root Warn the user that this is not supposed to work. Developers who know what they are doing know to ignore this message, others should think twice. Signed-off-by: Pekka Paalanen --- libweston/launcher-direct.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c index 3bee27a2..d687ce3a 100644 --- a/libweston/launcher-direct.c +++ b/libweston/launcher-direct.c @@ -232,6 +232,12 @@ launcher_direct_open(struct weston_launcher *launcher_base, const char *path, in if (fd == -1) return -1; + if (geteuid() != 0) { + weston_log("WARNING! Succeeded opening %s as non-root user." + " This implies your device can be spied on.\n", + path); + } + if (fstat(fd, &s) == -1) { close(fd); return -1;