Skip to content

Commit

Permalink
Don't allow setting hostname if not unsharing UTS namespace
Browse files Browse the repository at this point in the history
This is normally verified on argument validation, but it may happen
if someone managed to send custom priv-sep operations via e.g. ptrace.

See #107

Closes: #108
Approved by: alexlarsson
  • Loading branch information
alexlarsson authored and rh-atomic-bot committed Oct 13, 2016
1 parent 98b51e4 commit 133dcb7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bubblewrap.c
Expand Up @@ -612,6 +612,10 @@ privileged_op (int privileged_op_socket,
break;

case PRIV_SEP_OP_SET_HOSTNAME:
/* This is checked at the start, but lets verify it here in case
something manages to send hacked priv-sep operation requests. */
if (!opt_unshare_uts)
die ("Refusing to set hostname in original namespace");
if (sethostname (arg1, strlen(arg1)) != 0)
die_with_error ("Can't set hostname to %s", arg1);
break;
Expand Down

0 comments on commit 133dcb7

Please sign in to comment.