From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796294468; b=jks81EMqf49S5x6JQ+zd4Gprt4rCJZjuwo6w7CZ70Ww+j2dFUW7QPdS8zyCcTcOZuBPj n2qh9x9h6MKxaK4qVPv8NYrzBuXI4cPCeNx7EQyNCp7SKDDUrZpxn2+VCB+VscYN4FY23 TOmX/Sl7bzdi8Zme2J2JHxoA0U6Wf6Osj1ZHzS+UzcqNHPY0SShiHBRgoeQ8FuwxFFgxz znrPiTYcxSO0ptPCUKM7psKbXhDZygTLDNLPARLCogU244/U5czfkq/6zI+gMU/d4DHYA 51fOpYYLPyh/cj+Cm5/QBCP4qAbbrPrE2URV/52I7aUhhdh39bjcAuJ8pp0tPUrKKYA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796294468; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=kZuQWl5nhx89NA1fCQWSkV0ib+6laevcEhi7J8JLSfg=; b=B5nWF7XWD+2Ir9tDMgX5VgFCOxx12lu3HFVr46JApQ2PicX0pEXJzcHCakrQEscxa8Qt wagRfwzM6tQzP+Lt1IaY8gD8+7rniovYw7hvX/6SFV6O90NHDWaFed3spXDvUfjDcQbp/ ASYZyA+E1FgEhQmak0S9GKEBmUPqE77RzjUCdxWyg6tMfXTk+kHJzKCX7hCaESx/+Sm1B QYdxiyVy+CqJ/rOzkP8gUgumwxVL/AYJsH5NBIKz+YUBxmkmPIUvjbfuUxJFwTI0ymD5g lrQmtELBruoGK/J2W/UpO2IUtSlNFA5DMAZHoKd9zQX1JSub8IfSYtYi7rLMhj8AdZQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=P1fdU0mK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2EF9606A322 for ; Thu, 3 Dec 2026 10:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=P1fdU0mK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 338821F000C1 for ; Thu, 3 Dec 2026 10:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796294468; bh=kZuQWl5nhx89NA1fCQWSkV0ib+6laevcEhi7J8JLSfg=; h=From:Subject:Reply-To:Cc:In-Reply-To:References:Date; b=P1fdU0mKjLRcJttrLFo9PXxKQU+PpCNAWoloHCIpZqwK4+dgdU5YzvfSMg3EL/Eui LS0NIXXK+8eVHeLUEb9ld6UA2JS9fxjHc10VmUtbiKtGl1isvTmpjwu0X5hC3mDHGA Cgl+RYeuKf4UDtwmDX0kdqlS68yOUXbCGhEffB+iv9Zj/Gh7RpaFEv0k+aNo6RxBxS /XAnfsqiJW1fSRC/70OeISQxXyLQCboNp44l1ArpxFLgnOvRqPqYID9GGjQ0Zf8RC7 3xc1MPXgspiuN11gITqqNPOHQr4puC3udeZxK7brTUlcQn9mTC3XNAt5TBATa4zhkQ G6T9NKiNroTtw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] ovl: put the copy-up credentials when the copy_up hook fails Reply-To: sashiko-reviews@lists.linux.dev Cc: linux-security-module@vger.kernel.org In-Reply-To: <20261203104244.1015716-1-a.s.protopopov@gmail.com> References: <20261203104244.1015716-1-a.s.protopopov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 10:41:07 +0000 X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > The security_inode_copy_up() function calls the inode_copy_up hook of > every LSM in turn and stops at the first error. SELinux and Smack > allocate new credentials with prepare_creds() and return them in > *new. If an LSM which runs after them fails the hook, for example a > BPF LSM program which denies the copy-up, ovl_prepare_copy_up_creds() > returns the error and the credentials leak. Nobody puts them: the > cleanup of the copy_up_creds class skips error pointers. >=20 > Put the credentials before returning the error. put_cred() accepts > NULL, so this is also right when no LSM allocated them. >=20 > Fixes: d8ad8b496184 ("security, overlayfs: provide copy up security hook = for unioned files") > Signed-off-by: Anton Protopopov Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203104244.1015= 716-1-a.s.protopopov@gmail.com?part=3D1