[lxc-devel] [lxc/lxc] 344c9d: lxc_unshare: Add uid_mapping when creating userns

GitHub noreply at github.com
Mon Dec 4 11:10:25 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 344c9d813cf9602fc831483b6407ed276c8f58e9
      https://github.com/lxc/lxc/commit/344c9d813cf9602fc831483b6407ed276c8f58e9
  Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
  Date:   2017-12-01 (Fri, 01 Dec 2017)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/tools/lxc_unshare.c

  Log Message:
  -----------
  lxc_unshare: Add uid_mapping when creating userns

Change conf.c to export function write_id_mapping, which will now be
called inside main function of lxc_unshare.c.

This is required because setuid syscalls only permits a new userns to
set a new uid if the uid of parameter is mapped inside the ns using
uid_map file[1]. So, just after the clone invocation, map the uid passed as
parameter into the newly created user namespace, and put the current uid
as the ID-outside-ns. After the mapping is done, setuid call succeeds.

Closes: #494

[1] https://elixir.free-electrons.com/linux/latest/source/kernel/user_namespace.c#L286

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>


  Commit: 68eeee2f479ca62cb7e92dd99991109a87d67354
      https://github.com/lxc/lxc/commit/68eeee2f479ca62cb7e92dd99991109a87d67354
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-12-04 (Mon, 04 Dec 2017)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/tools/lxc_unshare.c

  Log Message:
  -----------
  Merge pull request #1979 from marcosps/issue_494

lxc_unshare: Add uid_mapping when creating userns


Compare: https://github.com/lxc/lxc/compare/7ded3c18782c...68eeee2f479c


More information about the lxc-devel mailing list