18 Sep, 2012

6 commits


14 Sep, 2012

3 commits

  • In net/dns_resolver/dns_key.c and net/rxrpc/ar-key.c make them
    work with user namespaces enabled where key_alloc takes kuids and kgids.
    Pass GLOBAL_ROOT_UID and GLOBAL_ROOT_GID instead of bare 0's.

    Cc: Sage Weil
    Cc: ceph-devel@vger.kernel.org
    Cc: David Howells
    Cc: David Miller
    Cc: linux-afs@lists.infradead.org
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • - Replace key_user ->user_ns equality checks with kuid_has_mapping checks.
    - Use from_kuid to generate key descriptions
    - Use kuid_t and kgid_t and the associated helpers instead of uid_t and gid_t
    - Avoid potential problems with file descriptor passing by displaying
    keys in the user namespace of the opener of key status proc files.

    Cc: linux-security-module@vger.kernel.org
    Cc: keyrings@linux-nfs.org
    Cc: David Howells
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Blink Blink this had not been converted to use struct pid ages ago?

    - On drm open capture the openers kuid and struct pid.
    - On drm close release the kuid and struct pid
    - When reporting the uid and pid convert the kuid and struct pid
    into values in the appropriate namespace.

    Cc: dri-devel@lists.freedesktop.org
    Acked-by: Dave Airlie
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     

07 Sep, 2012

3 commits


24 Aug, 2012

2 commits


17 Aug, 2012

1 commit


15 Aug, 2012

21 commits

  • Cc: Maxim Krasnyansky
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Cc: Dan Carpenter
    Cc: Alexey Dobriyan
    Cc: John W. Linville
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • - Only allow adding matches from the initial user namespace
    - Add the appropriate conversion functions to handle matches
    against sockets in other user namespaces.

    Cc: Jan Engelhardt
    Cc: Patrick McHardy
    Cc: Pablo Neira Ayuso
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • xt_recent creates a bunch of proc files and initializes their uid
    and gids to the values of ip_list_uid and ip_list_gid. When
    initialize those proc files convert those values to kuids so they
    can continue to reside on the /proc inode.

    Cc: Pablo Neira Ayuso
    Cc: Patrick McHardy
    Cc: Jan Engelhardt
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • xt_LOG always writes messages via sb_add via printk. Therefore when
    xt_LOG logs the uid and gid of a socket a packet came from the
    values should be converted to be in the initial user namespace.

    Thus making xt_LOG as user namespace safe as possible.

    Cc: Pablo Neira Ayuso
    Cc: Patrick McHardy
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • The flow classifier can use uids and gids of the sockets that
    are transmitting packets and do insert those uids and gids
    into the packet classification calcuation. I don't fully
    understand the details but it appears that we can depend
    on specific uids and gids when making traffic classification
    decisions.

    To work with user namespaces enabled map from kuids and kgids
    into uids and gids in the initial user namespace giving raw
    integer values the code can play with and depend on.

    To avoid issues of userspace depending on uids and gids in
    packet classifiers installed from other user namespaces
    and getting confused deny all packet classifiers that
    use uids or gids that are not comming from a netlink socket
    in the initial user namespace.

    Cc: Patrick McHardy
    Cc: Eric Dumazet
    Cc: Jamal Hadi Salim
    Cc: Changli Gao
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • cls_flow.c plays with uids and gids. Unless I misread that
    code it is possible for classifiers to depend on the specific uid and
    gid values. Therefore I need to know the user namespace of the
    netlink socket that is installing the packet classifiers. Pass
    in the rtnetlink skb so I can access the NETLINK_CB of the passed
    packet. In particular I want access to sk_user_ns(NETLINK_CB(in_skb).ssk).

    Pass in not the user namespace but the incomming rtnetlink skb into
    the the classifier change routines as that is generally the more useful
    parameter.

    Cc: Jamal Hadi Salim
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • At logging instance creation capture the peer netlink socket's user
    namespace. Use the captured peer user namespace when reporting socket
    uids to the peer.

    The peer socket's user namespace is guaranateed to be valid until the user
    closes the netlink socket. nfnetlink_log removes instances during the final
    close of a socket. __build_packet_message does not get called after an
    instance is destroyed. Therefore it is safe to let the peer netlink socket
    take care of the user namespace reference counting for us.

    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Compute the user namespace of the socket that we are replying to
    and translate the kuids of reported sockets into that user namespace.

    Cc: Andrew Vagin
    Acked-by: David S. Miller
    Acked-by: Pavel Emelyanov
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Add a helper sk_user_ns to make it easy to find the user namespace
    of the process that opened a socket.

    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • The sending socket of an skb is already available by it's port id
    in the NETLINK_CB. If you want to know more like to examine the
    credentials on the sending socket you have to look up the sending
    socket by it's port id and all of the needed functions and data
    structures are static inside of af_netlink.c. So do the simple
    thing and pass the sending socket to the receivers in the NETLINK_CB.

    I intend to use this to get the user namespace of the sending socket
    in inet_diag so that I can report uids in the context of the process
    who opened the socket, the same way I report uids in the contect
    of the process who opens files.

    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Cc: Ralf Baechle
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • There is a least one modular user so export free_pid_ns so modules can
    capture and use the pid namespace on the very rare occasion when it
    makes sense.

    Acked-by: David S. Miller
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • Correct a long standing omission and use struct pid in the owner
    field of struct ip6_flowlabel when the share type is IPV6_FL_S_PROCESS.
    This guarantees we don't have issues when pid wraparound occurs.

    Use a kuid_t in the owner field of struct ip6_flowlabel when the
    share type is IPV6_FL_S_USER to add user namespace support.

    In /proc/net/ip6_flowlabel capture the current pid namespace when
    opening the file and release the pid namespace when the file is
    closed ensuring we print the pid owner value that is meaning to
    the reader of the file. Similarly use from_kuid_munged to print
    uid values that are meaningful to the reader of the file.

    This requires exporting pid_nr_ns so that ipv6 can continue to built
    as a module. Yoiks what silliness

    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • - Store sysctl_ping_group_range as a paire of kgid_t values
    instead of a pair of gid_t values.
    - Move the kgid conversion work from ping_init_sock into ipv4_ping_group_range
    - For invalid cases reset to the default disabled state.

    With the kgid_t conversion made part of the original value sanitation
    from userspace understand how the code will react becomes clearer
    and it becomes possible to set the sysctl ping group range from
    something other than the initial user namespace.

    Cc: Vasiliy Kulikov
    Acked-by: David S. Miller
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Cc: Alexey Kuznetsov
    Cc: James Morris
    Cc: Hideaki YOSHIFUJI
    Cc: Patrick McHardy
    Cc: Arnaldo Carvalho de Melo
    Cc: Sridhar Samudrala
    Acked-by: Vlad Yasevich
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • struct file already has a user namespace associated with it
    in file->f_cred->user_ns, unfortunately because struct
    seq_file has no struct file backpointer associated with
    it, it is difficult to get at the user namespace in seq_file
    context. Therefore add a helper function seq_user_ns to return
    the associated user namespace and a user_ns field to struct
    seq_file to be used in implementing seq_user_ns.

    Cc: Al Viro
    Cc: Eric Dumazet
    Cc: KAMEZAWA Hiroyuki
    Cc: Alexey Dobriyan
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Now that the networking core is user namespace safe allow
    networking and user namespaces to be built at the same time.

    Acked-by: David S. Miller
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Cc: Klaus Heinrich Kiwi
    Cc: Eric Paris
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • With the existence of kuid_t and kgid_t we can take this further
    and remove the usage of struct cred altogether, ensuring we
    don't get cache line misses from reference counts. For now
    however start simply and do a straight forward conversion
    I can be certain is correct.

    In cred_to_ucred use from_kuid_munged and from_kgid_munged
    as these values are going directly to userspace and we want to use
    the userspace safe values not -1 when reporting a value that does not
    map. The earlier conversion that used from_kuid was buggy in that
    respect. Oops.

    Cc: Eric Dumazet
    Acked-by: David S. Miller
    Acked-by: Serge Hallyn
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     

04 Aug, 2012

1 commit


03 Aug, 2012

3 commits

  • The user namespace code has an explicit "depends on USB_DEVICEFS = n"
    dependency to prevent building code that is not yet user namespace safe. With
    the removal of usbfs from the kernel it is now impossible to satisfy the
    USB_DEFICEFS = n dependency and thus it is impossible to enable user
    namespace support in 3.5-rc1. So remove the now useless depedency.

    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Linus Torvalds
     
  • Pull OLPC platform updates from Andres Salomon:
    "These move the OLPC Embedded Controller driver out of
    arch/x86/platform and into drivers/platform/olpc.

    OLPC machines are now ARM-based (which means lots of x86 and ARM
    changes), but are typically pretty self-contained.. so it makes more
    sense to go through a separate OLPC tree after getting the appropriate
    review/ACKs."

    * 'for-linus-3.6' of git://dev.laptop.org/users/dilinger/linux-olpc:
    x86: OLPC: move s/r-related EC cmds to EC driver
    Platform: OLPC: move global variables into priv struct
    Platform: OLPC: move debugfs support from x86 EC driver
    x86: OLPC: switch over to using new EC driver on x86
    Platform: OLPC: add a suspended flag to the EC driver
    Platform: OLPC: turn EC driver into a platform_driver
    Platform: OLPC: allow EC cmd to be overridden, and create a workqueue to call it
    drivers: OLPC: update various drivers to include olpc-ec.h
    Platform: OLPC: add a stub to drivers/platform/ for the OLPC EC driver

    Linus Torvalds