Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp508439lqb; Fri, 24 May 2024 05:33:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMS6B4XszQ7ytHBrxH9jJUUlwqxF14O3mDb+BdPFhv44QcsKGSRUv+UtAQYcj5b/hRyjODHSSWp7pgd74kYSlsUZapHZUOihzEfHd92A== X-Google-Smtp-Source: AGHT+IEQrUbgd5llR0YmrYyXr3KxJgPj64AE8oNATWS2HT96HYQx0nolvmrcNBJqcmJEbYx1UmzJ X-Received: by 2002:a05:6214:4589:b0:6ab:9587:3769 with SMTP id 6a1803df08f44-6abccfadaaemr20756636d6.45.1716554020952; Fri, 24 May 2024 05:33:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716554020; cv=pass; d=google.com; s=arc-20160816; b=jLfx0i7LQG4RzQq9Tqxg2EvfR5V5LHFhCfasiAVUlDw/7RKYQu7/nzGk/uhkjhFg6x OG+5/NWtR9JU1zPdW5FNUaPaOzNHfN0HiKp/sREd6lcCETsSfgzotHOcUQiegFfm/sqP VxyX3qP93MAxx1d7ybfQzooFb+VMaClGayloGKMeEZfRrgreJFL9BXcAdh5HzrOazAHV TNRY0yJWNfdaooJEIdqA515wSgg/iVpXIScKT5QBHlsCsAc3w0xnnTm09QtpqrDJczt2 lGLLMmSAfHmDRcPp20XwJcab0WrEarJ77y1X0EZ1Z+/FMMeG4xidrrgX/D6m2SZQlcsl K7ow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=TLsBKhDgR7+GRQQdmpyxH/q5JezC37lhhqw8XLyE/3Q=; fh=wFiGH1yCrM/CfXYYe5qX76Rj8ilrQZHZRswFcRyEnLk=; b=uvIgDxxVZC8VqFfqIrlnMyck4Qz61pQ6yrxfBoqGNG3cBqBPDUZ0ljUVertMYQGjCs h1o+Quk4t+aFk0eQpaUMa9GisjBpdH5cSEVkSdS2vLxa79TCSOB9pvw/beD/LJJlt8Jo AZw1mwDrqrGjjSTSpcnmoai21UO2MlWhh2LEW5K+UQ6Fs2LcuN0rQl1MnaxE30rK0rH7 3db1SYAtP84dKX0XfAMsLfKf0+YsZs+N7+F+5oH584Zjzlc263LHUESvhlBznjiV9dcS bGDtEK0LCGZdx6w9VkJ2UG234EO1tb502ytq1okwg0uTj8VKwGpyD88fiStgsuu6ZpVd yRGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GwS2kyDT; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-188692-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188692-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac162d10basi15975496d6.554.2024.05.24.05.33.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 05:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188692-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GwS2kyDT; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-188692-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188692-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9D5241C20E3D for ; Fri, 24 May 2024 12:33:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E8CF86255; Fri, 24 May 2024 12:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GwS2kyDT" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55E511E49E for ; Fri, 24 May 2024 12:33:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716554013; cv=none; b=jLsKeNf6qLqEXvR8szUehY5rjQPl6QpnLucgUciWP19OfFFZYxf+I7VTrBQfFcMuwutUEDuKE35ou2h09PQUrxws9cGWcG3JexrNWu5yJ796TKTCl0y5yI9UFJMLCF85huvo91SVfPrEcNC6Wu6sxn9pXsjNeuZD0B05IsnUTc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716554013; c=relaxed/simple; bh=VCpzmu/uQpvZqx8rPcVdmguYmBeksK6kt7jSS1WlJUc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=oiOW54Yr+o/PfaGyBQZYb/wwjdq5yE9ydCPSQ27VMk0rJwCojDPDyOU1cZIKLF1qgWh2Mj788COLkmsvYmI4ShVh/aevlC99u2v/gL8XbDeos6jcGtNhs65Lt+go1Ultp2x0a1b4mo4K7W5kS6dUDr4uoOG/hERywxqKDvLeC6c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GwS2kyDT; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716554010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TLsBKhDgR7+GRQQdmpyxH/q5JezC37lhhqw8XLyE/3Q=; b=GwS2kyDTeqP2dzcf5HtZOeWGJynTY03J8Xy+UWxmKxVtNNrXG1SFkx6GZcuQ/QS0O7NNrc sKwHadYFkdlQy5in8KLtq8NODr8iOZ2uH8dB0ICsPJrz7vtHXzRHFo6Q3wfiJKEMmzIOgK flQLXYXzqYqHJxsjGeTtTmPPT4PCoVw= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-340-rm12_HntMp2MjHtavemGSA-1; Fri, 24 May 2024 08:33:22 -0400 X-MC-Unique: rm12_HntMp2MjHtavemGSA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52395bc1813so1880539e87.2 for ; Fri, 24 May 2024 05:33:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716554001; x=1717158801; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TLsBKhDgR7+GRQQdmpyxH/q5JezC37lhhqw8XLyE/3Q=; b=El/wd8xOawLDig2emhabejFa3ZHHTf05NJVripsWoFNJAS3zj4Nf0gXPzAzmx4ZkJ/ WbR7wcIszVAZBP8lsjLjlApkA/byyY5IQjtRVVa+zfbGc0n7ncEWhq7DjkZsmDvOyoJA 09zpz/lrSZDa36o79tUdJ92pH+4YRaWL+44ATktNnGs6WZ1xSPKm68Qzn4b66q78gQr4 ycdTgsBBXDSAg/luydY0rthl6oINUe3tlxilf5rpCFqDGYOzESHnBXYAdzV1wo7b+JD6 1Tr+Y3uRoZzOwsmkxTgnoPYWBactRS78EsJ+9EHBFgXxv05nyuTdZbPmH/P3kpoICXMO nSDA== X-Gm-Message-State: AOJu0Yy6xGG8q5co3uIiQNxM07BGowZs2LMe3f1Ii6VYAODpIDkMYbDn Y6Sta14J5N/Eh5ahBV7nX6D71NN3KlRJUfqfJtGa/nK+5BDvZVamAuwkunXGyT+6JUXx3PkGYYI sQ8a8N0m1JWa74eN12HqI3aP/JLcJ27IiH9N9/5DHFZsVEUmat21z9W3WsZOMiQ== X-Received: by 2002:ac2:54b6:0:b0:51d:9818:33fa with SMTP id 2adb3069b0e04-529666db5e1mr1076627e87.68.1716554001265; Fri, 24 May 2024 05:33:21 -0700 (PDT) X-Received: by 2002:ac2:54b6:0:b0:51d:9818:33fa with SMTP id 2adb3069b0e04-529666db5e1mr1076609e87.68.1716554000577; Fri, 24 May 2024 05:33:20 -0700 (PDT) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4210897c089sm19650655e9.24.2024.05.24.05.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 05:33:20 -0700 (PDT) From: Javier Martinez Canillas To: Christian Brauner Cc: linux-kernel@vger.kernel.org, Daniel Lezcano , "Eric W . Biederman" , javier@dowhile0.org, Andrew Morton , "Gustavo A. R. Silva" , Masahiro Yamada , Nhat Pham , Petr Mladek , Randy Dunlap , Vincent Guittot , Yoann Congal Subject: Re: [PATCH] userns: Default to 'yes' when CONFIG_MEMCG option is enabled In-Reply-To: <20240524-beurkunden-kantig-101649d6b5cf@brauner> References: <20240524082434.657573-1-javierm@redhat.com> <20240524-beurkunden-kantig-101649d6b5cf@brauner> Date: Fri, 24 May 2024 14:33:19 +0200 Message-ID: <874jangzjk.fsf@minerva.mail-host-address-is-not-set> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Christian Brauner writes: Hello Christian, Thanks a lot for your feedback. > On Fri, May 24, 2024 at 10:24:16AM +0200, Javier Martinez Canillas wrote: >> The default value for the CONFIG_USER_NS Kconfig symbol changed over tim= e. >>=20 >> When first was introduced by commit acce292c82d4 ("user namespace: add t= he >> framework"), the default was 'no'. But then it was changed to 'yes' if t= he >> CONFIG_NAMESPACES option was enabled, by commit 17a6d4411a4d ("namespace= s: >> default all the namespaces to 'yes' when CONFIG_NAMESPACES is selected"). >>=20 >> Then, commit 5673a94c1457 ("userns: Add a Kconfig option to enforce stri= ct >> kuid and kgid type checks") changed the default to 'no' again and select= ed >> the (now defunct) UIDGID_STRICT_TYPE_CHECKS option. >>=20 >> This selected option was removed by commit 261000a56b63 ("userns: Remove >> UIDGID_STRICT_TYPE_CHECKS"), but CONFIG_USER_NS default was left to 'no'. >>=20 >> Finally, the commit e11f0ae388f2 ("userns: Recommend use of memory contr= ol >> groups") added to the Kconfig symbol's help text a recommendation that t= he >> memory control groups should be used, to limit the amount of memory that= a >> user who can create user namespaces can consume. >>=20 >> Looking at the changes' history, a default to 'yes' when the CONFIG_MEMCG >> option is enabled seems like a sane thing to do. Specially since systemd >> requires user namespaces support for services that use the PrivateUsers= =3D >> property in their unit files (e.g: the UPower daemon). > > Fyi, user namespaces are an entirely optional feature in systemd and it > gracefully falls back if they are not available with PrivateUsers=3D set. > If that isn't the case then it's a bug in systemd with PrivateUsers=3D > handling and should be reported. > Interesting, it definitely failed for me: $ systemctl status upower =E2=97=8F upower.service - Daemon for power management Loaded: loaded (/lib/systemd/system/upower.service; disabled; vendor p= reset: enabled) Active: failed (Result: exit-code) since Fri 2024-05-24 12:23:49 UTC; = 34s ago Docs: man:upowerd(8) Process: 390 ExecStart=3D/usr/libexec/upowerd (code=3Dexited, status=3D= 217/USER) Main PID: 390 (code=3Dexited, status=3D217/USER) CPU: 122ms May 24 12:23:49 igep systemd[1]: upower.service: Scheduled restart job, res= tart counter is at 5. May 24 12:23:49 igep systemd[1]: Stopped Daemon for power management. May 24 12:23:49 igep systemd[1]: upower.service: Start request repeated too= quickly. May 24 12:23:49 igep systemd[1]: upower.service: Failed with result 'exit-c= ode'. May 24 12:23:49 igep systemd[1]: Failed to start Daemon for power managemen= t. $ journalctl -u upower May 24 12:23:49 igep systemd[1]: Starting Daemon for power management... May 24 12:23:49 igep systemd[404]: upower.service: Failed to set up user na= mespacing: Invalid argument May 24 12:23:49 igep systemd[404]: upower.service: Failed at step USER spaw= ning /usr/libexec/upowerd: Invalid argument May 24 12:23:49 igep systemd[1]: upower.service: Main process exited, code= =3Dexited, status=3D217/USER May 24 12:23:49 igep systemd[1]: upower.service: Failed with result 'exit-c= ode'. May 24 12:23:49 igep systemd[1]: Failed to start Daemon for power managemen= t. May 24 12:23:49 igep systemd[1]: upower.service: Scheduled restart job, res= tart counter is at 1. May 24 12:23:49 igep systemd[1]: Stopped Daemon for power management. That lead me to https://gitlab.freedesktop.org/upower/upower/-/issues/104 and finally to systemd's README: https://github.com/systemd/systemd/blob/main/README#L89C22-L89C34=20 But I'll investigate more if is upower or systemd to be blamed here... > But specifically to you change, afair CONFIG_MEMCG and userns are > unrelated so tying them together like this in the kconfig seems > misguided. > Yes, but the config USER_NS help text already tieds them toghether: help This allows containers, i.e. vservers, to use user namespaces to provide different user info for different servers. When user namespaces are enabled in the kernel it is recommended that the MEMCG option also be enabled and that user-space use the memory control groups to limit the amount of memory a memory unprivileged users can use. And as mentioned in the commit message, it seems to be the reason why the default for this Kconfig symbol is no. Maybe I misunderstood though or do you think that could be switched unconditionally to 'default y' ? Or is there a reason to be the only namespace to be default to no instead of yes? Specially since important system services are trying to use it. --=20 Best regards, Javier Martinez Canillas Core Platforms Red Hat