From patchwork Tue May 2 14:18:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 89395 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp656222vqo; Tue, 2 May 2023 07:26:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fLfjFVrRxWiQoWcWwvwj21zwN2MXVhFvX94xJUn1M0dpKVqXlVb11DZ0uBY20+gX3n6I0 X-Received: by 2002:aca:3257:0:b0:38e:32b5:cfba with SMTP id y84-20020aca3257000000b0038e32b5cfbamr9451309oiy.10.1683037601140; Tue, 02 May 2023 07:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683037601; cv=none; d=google.com; s=arc-20160816; b=rm0dexT8sRCf8Yg2bZxIbDJVs1AcjkRg4T6UJPjdufIkHgRo/akkIB/U2cS1T8+bIV U1oNy1gG4X+yEzB/4RDnmrRsqlplRInscHmvA2uhpq3VzZbg0pZxTpkbRJNV6RZIjbqg u88tRuBO5wKuNberjfM0LbS9BThaSgtO6U1xPF3OIYwxRu958tmUi9PJbEuZZSSkRiqN vUH2d5f7PE6vbpMRzhyhn+S4fDtkQKrytjwVVyKts2mH6zRsqwZ+0nv9/PAPgITIU3hd W+xUKhVH3Bx4SD5G8xI75eeszXqMlbpg7iDXmUbnLObz1o8TYNmI7mESkYsZlEBlGXW0 JUBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YEbt8fJaJHySlZTdZRpdSbFwcXzeFhKie6WmHehZH00=; b=UmLr5G2BXsunzgLnfttos4jbLtm+VZkTrN/EdY8yA6/b/SrhGIgcBeA8ygSNgQCdS5 ymw6dlvvsO/pI3INCXS1r8kCPsCGxPJO0WPey8pw1lTM2R3cOfztopTRGAizktAlcqJk n/5EZzoqvMTDz1tSjN6cE7+tr84n2/4oYuw5FAw9mwk5Q7TYLCVHb2M85Wr4+gN1PMN2 cam/fRSpFJ+qvmyJvAIllFe9/ZZL+fNh4MPM0DcHmIO1p/reQ8poxjKS9gGvATTsjC8M AvZv5/jxf/q06bxPR6Aa/93ihH6shu77OZ4PKKDS6bD0A/VlrYnRv49Uq+IQ6GPTVJmZ Ah8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=DKVJ+Zur; 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=canonical.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z84-20020aca3357000000b0038e1280d5e9si22116792oiz.1.2023.05.02.07.26.23; Tue, 02 May 2023 07:26:41 -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=@canonical.com header.s=20210705 header.b=DKVJ+Zur; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234339AbjEBOT6 (ORCPT + 99 others); Tue, 2 May 2023 10:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233849AbjEBOTu (ORCPT ); Tue, 2 May 2023 10:19:50 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 484C3E9 for ; Tue, 2 May 2023 07:19:49 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id A5CFC3F445 for ; Tue, 2 May 2023 14:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683037183; bh=YEbt8fJaJHySlZTdZRpdSbFwcXzeFhKie6WmHehZH00=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=DKVJ+Zur1RXebmECPN8zKujN1W7Z+zyKs5JZkbep/04ljj6a8tHRn+Ha9tfFYtT3m /ODtKG5LnGXbNXNVl1a5urwdQHq6R8a0cSSGW+0PUngZj45518GuXnHrKeGl2C5yNh F4z5HmM6UpnIDWceuj0ssVus40G9jLkFKe1owrWlmOHQMd0P5TqMh5jdoTTeq4FHKc ObD51jGVNAKtU5oEKaG1je47tPRFEjRyoGpjC4/hMKZFEZq85AOmah5ASg9hsaAopQ USL7FaJf4X1RdiaTkA09xjqXS/qYAJETEhg2jA3h/zhse4j7hl64L//udFrhPReOlJ rHWG/B0KwgrRQ== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-94a356c74e0so383231166b.2 for ; Tue, 02 May 2023 07:19:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683037183; x=1685629183; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YEbt8fJaJHySlZTdZRpdSbFwcXzeFhKie6WmHehZH00=; b=YBmda+JNpaBEllbM4CVsRanwCPogW4BDoLXXLFYFQ5RivkmX7Tg15OsoR4ShiqNF60 JlWXhXuAj30q+u48pW4eFXD0d1xyE/Q0Xcxt5A1Qt7Qq1YK+vvGbWlRPJIeHkfV8o0FD pPpQNU6ybnQUvfIYnSOzf7RuNmNqzlPit4sVB/XdOUnYwaRejzo3t0lYzBZHn0Rh0Ue7 2RB4O+cs019qykY0bWP36s4F7goNrOJlpyeU9Y+wH/Tt44QcSMXf74H6fFK4bUsEOkiV WQCBoCAHrk5kkZGFINPIBnmUUpebEYPvyqWYt76e/yQfWO0nqNKDhpLMh/6ML8b5OLBD /9/w== X-Gm-Message-State: AC+VfDzszRKZpI0nl8gyZjQY2V+x4ZmnrnvgjaioR+F8A7Qe1RMZZw3v zgAnwDniFZVr0TulDYt6zK923F2ugQdo724ULQvPGuJyueb29splX9ZRhk//oHH4NDJPAVAwftG VFEt3m3HBMqsLe/UEmq7UvQ9Z+4kBNmThzAAVCw80aozS3FDzVc1h X-Received: by 2002:a17:907:36c7:b0:94f:6025:be53 with SMTP id bj7-20020a17090736c700b0094f6025be53mr82663ejc.50.1683037182991; Tue, 02 May 2023 07:19:42 -0700 (PDT) X-Received: by 2002:a17:907:36c7:b0:94f:6025:be53 with SMTP id bj7-20020a17090736c700b0094f6025be53mr82651ejc.50.1683037182694; Tue, 02 May 2023 07:19:42 -0700 (PDT) Received: from amikhalitsyn.. ([62.168.35.11]) by smtp.gmail.com with ESMTPSA id tk5-20020a170907c28500b0095004c87676sm16000802ejc.199.2023.05.02.07.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 07:19:42 -0700 (PDT) From: Alexander Mikhalitsyn To: mortonm@chromium.org Cc: Alexander Mikhalitsyn , Paul Moore , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] LSM: SafeSetID: fix UID printed instead of GID Date: Tue, 2 May 2023 16:18:32 +0200 Message-Id: <20230502141832.217234-1-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764792835596251683?= X-GMAIL-MSGID: =?utf-8?q?1764792835596251683?= pr_warn message clearly says that GID should be printed, but we have UID there. Let's fix that. Found accidentaly during the work on isolated user namespaces. Signed-off-by: Alexander Mikhalitsyn --- security/safesetid/lsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/safesetid/lsm.c b/security/safesetid/lsm.c index e806739f7868..6191e5ba0f70 100644 --- a/security/safesetid/lsm.c +++ b/security/safesetid/lsm.c @@ -131,7 +131,7 @@ static int safesetid_security_capable(const struct cred *cred, * set*gid() (e.g. setting up userns gid mappings). */ pr_warn("Operation requires CAP_SETGID, which is not available to GID %u for operations besides approved set*gid transitions\n", - __kuid_val(cred->uid)); + __kuid_val(cred->gid)); return -EPERM; default: /* Error, the only capabilities were checking for is CAP_SETUID/GID */