Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2008849rwb; Thu, 29 Sep 2022 05:13:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5u/9mzgQ/T4i8C4XHYM7JP7XEIEUgpGu2wgCTSmTaRhwNqH/KfD8Zfj3RI+R86pX8xtAmX X-Received: by 2002:a17:90b:1a90:b0:202:ff17:4a80 with SMTP id ng16-20020a17090b1a9000b00202ff174a80mr16186504pjb.213.1664453638966; Thu, 29 Sep 2022 05:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664453638; cv=none; d=google.com; s=arc-20160816; b=sJAYJBBb05l6MBgg3Egfy6EiULq1R+0oMe5BCqWxiHoBO8u/4uahEqXBYx5/+HKvZ0 9p2N4Ja8RM0HmQ0v+msUF10hlVNKktEWF0plVuYpzBLyTzfkCUegd0BT3BCF8ksCrtyN 0HqscSbwtq9TGJhxy0OXO240ezYwyeb/gcW+y7zKvUZv6ZLSDVqLa3Ks0+B2cZLPwGR4 TtR5JGopH81/79+Qwa3dtCIfwJeeuaPZFNk+t9XCCPaRG1SXb8GMzIWNteV1L+qoQIwy jGJWB6LuHm6rnhsp09Qq23x63SBiVLUMCYct7yPt2pA4JAISOGeYdkCfNaKgul6RKuAX Zsuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SncErTPkyXAmtH63gY+1973Gb0ARDd3N9/UHP5Url/Q=; b=zckrLkHRi2W4h4UYwKHCFfAcC7VVckAbL9gUOVY/XBnI/tK3VWtMyVHm9APrPgQbUB REu0H/T44nnqdMZw8u5klwTBhEn5NZX5QLpLG/3dIGsKtw0WZKVG9pyvVutAq/og0Kxr gFjZHSxXtuozk6PaLutn1hyKjwd2l/NBp3KmqepnX7M4kH503YEidZXr/oQtLRPQE33B XREJ/w4+6RnB5Zi/KkOQBL+jK8uAEgbVLfKhpno+GkyiwMpyUAytySGv7gK/S8/LzqFg 8DovGJZ9r85IaeJzxgTpkPX9eXT1QcPtY3q1Tb5BeFDYNY3xjKXuCcgEqUhV9esumYHP tq8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r9VdoM7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020a056a0023d500b00540db8be1c0si6141193pfc.195.2022.09.29.05.13.46; Thu, 29 Sep 2022 05:13:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r9VdoM7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbiI2Lhr (ORCPT + 99 others); Thu, 29 Sep 2022 07:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235278AbiI2Lhp (ORCPT ); Thu, 29 Sep 2022 07:37:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBFE14F8CD; Thu, 29 Sep 2022 04:37:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B9DC6B8245F; Thu, 29 Sep 2022 11:37:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8B99C433C1; Thu, 29 Sep 2022 11:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664451461; bh=uRl5cXPSzrgDgZEmBB96Z+bBbGLnVEN9hWoSXJsFsP4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r9VdoM7VBo44GyTZ/Doqk0R4z7lK2DOILIkhkvdDQC8Yg/p0GfPUKcHWiLnbgxTvW AFQNfOyi8+DqJcoMBRrHREKi7r+4hJu27jdvbYeXPNmUC7zoq46TavZ2KvhjG9GXGX TUkUnv9vDZfP5wMNkH9mE9cohPSc8GejiwQv7LyB4SUuISiL4cL41MbCDWY9co9/Qc mQ3q/FuyII3Wqog9tNzaOg8ZaUHMtdTQeXT4Rapf2dB4arlLY4QBgPqAfqB1rtjJok MxANMkKHy7aqUdwNtn1IILfiSy8VX6VCqST26eppRlmNvLNB7rvoqn2ePcXAe5VRmr rstr/By0Jgbng== Date: Thu, 29 Sep 2022 13:37:35 +0200 From: Christian Brauner To: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= Cc: Hyunchul Lee , Namjae Jeon , Steve French , Al Viro , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1] ksmbd: Fix user namespace mapping Message-ID: <20220929113735.7k6fdu75oz4jvsvz@wittgenstein> References: <20220929100447.108468-1-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220929100447.108468-1-mic@digikod.net> X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 29, 2022 at 12:04:47PM +0200, Mickaël Salaün wrote: > A kernel daemon should not rely on the current thread, which is unknown > and might be malicious. Before this security fix, > ksmbd_override_fsids() didn't correctly override FS UID/GID which means > that arbitrary user space threads could trick the kernel to impersonate > arbitrary users or groups for file system access checks, leading to > file system access bypass. > > This was found while investigating truncate support for Landlock: > https://lore.kernel.org/r/CAKYAXd8fpMJ7guizOjHgxEyyjoUwPsx3jLOPZP=wPYcbhkVXqA@mail.gmail.com > > Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") > Cc: Hyunchul Lee > Cc: Namjae Jeon > Cc: Steve French > Cc: stable@vger.kernel.org > Signed-off-by: Mickaël Salaün > Link: https://lore.kernel.org/r/20220929100447.108468-1-mic@digikod.net > --- I think this is ok. The alternative would probably be to somehow use a relevant userns when struct ksmbd_user is created when the session is established. But these are deeper ksmbd design questions. The fix proposed here itself seems good.