From patchwork Fri Oct 21 00:46:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 6461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp404787wrr; Thu, 20 Oct 2022 17:55:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YSpTfmXJSJiSDk+A83nk40XHzVQ3lvE8jvCLq5ELlVCqg4qPYlktx5necH3LHy2Fjn+By X-Received: by 2002:a17:907:a4a:b0:77b:c1b2:479a with SMTP id be10-20020a1709070a4a00b0077bc1b2479amr10137720ejc.109.1666313712655; Thu, 20 Oct 2022 17:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666313712; cv=none; d=google.com; s=arc-20160816; b=USOUnObOAlL+mga97Iof1n9TxZgL6m5cae178QA9Rp4xwtJ585PqY0uO8Zj3b+uUGM Wrn4SktgJWWkOx35bn0iX73XwQzzTu5cjkT2YlMNYncKsjvM0A736GPnp7CAqbm+wUbW wMh1K4BQtCF3Pn94de+nosErqHwEomi9MOa49jDUDDrs7X1Y022wd0POED1KwakxOz4o MW+O93Asn47HmcRNyanVFZUsMbweW3HQjEraIeiHFJjhcdhhiylYaCeO2QdHqSlJzA7B YH9iTe3AlqqsxLzamhk03Ojzk0LjTGLUHlanxzCkqpVS4NQViM/3yl1S3AXap2ParWQH sT6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=0ZH7I2emOxQrduYY/W1d9KXW9lFvva9m+8rWPk887Po=; b=AY+2DUP1rv0iliXVYALMQB1uV9F5Wp/1akQiefxNvHtPaDFaj3xYKykl5Ul53wUE5W cDSCoJonmT9xCZtBozsDV/8N8NtOVkzhshaasTsvTkZta8apEZvN5+kfstuMmvyYDW4L OZy5LCgIerid0VWD5IVgbq0EkgQbnmG8FQwcidjuFiWu7mkD3EXvas4qP8N5qXc4FIr1 xkbyJ5ShUipTkH/oxjZ83TuJ0LTjIz9OX+XXXguWZ2CqqYUpko+c7o7yZVkqyNlF+FLF 8SuJUrjDO8XnXyMP7gqGYvZ2jukC9pjLFK3gxQ67ATmneAAr+XcFFBSn2W3qrd2kfIiv tRSQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a170906520b00b0078334ccc570si16502662ejm.328.2022.10.20.17.54.48; Thu, 20 Oct 2022 17:55:12 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbiJUAti (ORCPT + 99 others); Thu, 20 Oct 2022 20:49:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbiJUAte (ORCPT ); Thu, 20 Oct 2022 20:49:34 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE9310B44; Thu, 20 Oct 2022 17:49:31 -0700 (PDT) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mtm2V35bQzVj27; Fri, 21 Oct 2022 08:44:50 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.58) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 21 Oct 2022 08:49:29 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH v2] apparmor: Use pointer to struct aa_label for lbs_cred Date: Fri, 21 Oct 2022 08:46:04 +0800 Message-ID: <20221021004604.188986-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747256567932515740?= X-GMAIL-MSGID: =?utf-8?q?1747256567932515740?= According to the implementations of cred_label() and set_cred_label(), we should use pointer to struct aa_label for lbs_cred instead of struct aa_task_ctx, this patch fixes it. Fixes: bbd3662a8348 ("Infrastructure management of the cred security blob") Signed-off-by: Xiu Jianfeng Acked-by: John Johansen --- V2: fixes the comment too --- security/apparmor/lsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index f56070270c69..1e2f40db15c5 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -1194,10 +1194,10 @@ static int apparmor_inet_conn_request(const struct sock *sk, struct sk_buff *skb #endif /* - * The cred blob is a pointer to, not an instance of, an aa_task_ctx. + * The cred blob is a pointer to, not an instance of, an aa_label. */ struct lsm_blob_sizes apparmor_blob_sizes __lsm_ro_after_init = { - .lbs_cred = sizeof(struct aa_task_ctx *), + .lbs_cred = sizeof(struct aa_label *), .lbs_file = sizeof(struct aa_file_ctx), .lbs_task = sizeof(struct aa_task_ctx), };