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 containers#107
  • Loading branch information
alexlarsson committed Oct 13, 2016
1 parent cd408b3 commit 1112870
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 1112870

Please sign in to comment.