Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udevadm: ignoring request when run in chroot #11346

Merged
merged 1 commit into from Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
udevadm: refuse to run trigger, control, settle and monitor commands …
…in chroot

Closes #11333.
  • Loading branch information
yuwata committed Jan 7, 2019
commit b05a4c950a928b3407f983f4d9a8a2ff8cbc34f0
6 changes: 6 additions & 0 deletions src/udev/udevadm-control.c
Expand Up @@ -26,6 +26,7 @@
#include "udevadm.h"
#include "udev-ctrl.h"
#include "util.h"
#include "virt.h"

static int help(void) {
printf("%s control OPTION\n\n"
Expand Down Expand Up @@ -70,6 +71,11 @@ int control_main(int argc, char *argv[], void *userdata) {
if (r < 0)
return r;

if (running_in_chroot() > 0) {
log_info("Running in chroot, ignoring request.");
return 0;
}

if (argc <= 1)
log_error("Option missing");

Expand Down
6 changes: 6 additions & 0 deletions src/udev/udevadm-monitor.c
Expand Up @@ -17,6 +17,7 @@
#include "signal-util.h"
#include "string-util.h"
#include "udevadm.h"
#include "virt.h"

static bool arg_show_property = false;
static bool arg_print_kernel = false;
Expand Down Expand Up @@ -210,6 +211,11 @@ int monitor_main(int argc, char *argv[], void *userdata) {
if (r <= 0)
goto finalize;

if (running_in_chroot() > 0) {
log_info("Running in chroot, ignoring request.");
return 0;
}

/* Callers are expecting to see events as they happen: Line buffering */
setlinebuf(stdout);

Expand Down
6 changes: 6 additions & 0 deletions src/udev/udevadm-settle.c
Expand Up @@ -18,6 +18,7 @@
#include "udevadm.h"
#include "udev-ctrl.h"
#include "util.h"
#include "virt.h"

static usec_t arg_timeout = 120 * USEC_PER_SEC;
static const char *arg_exists = NULL;
Expand Down Expand Up @@ -88,6 +89,11 @@ int settle_main(int argc, char *argv[], void *userdata) {
if (r <= 0)
return r;

if (running_in_chroot() > 0) {
log_info("Running in chroot, ignoring request.");
return 0;
}

deadline = now(CLOCK_MONOTONIC) + arg_timeout;

/* guarantee that the udev daemon isn't pre-processing */
Expand Down
6 changes: 6 additions & 0 deletions src/udev/udevadm-trigger.c
Expand Up @@ -15,6 +15,7 @@
#include "strv.h"
#include "udevadm.h"
#include "udevadm-util.h"
#include "virt.h"

static bool arg_verbose = false;
static bool arg_dry_run = false;
Expand Down Expand Up @@ -158,6 +159,11 @@ int trigger_main(int argc, char *argv[], void *userdata) {
bool settle = false;
int c, r;

if (running_in_chroot() > 0) {
log_info("Running in chroot, ignoring request.");
return 0;
}

r = sd_device_enumerator_new(&e);
if (r < 0)
return r;
Expand Down