Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2049764rwd; Fri, 9 Jun 2023 06:06:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6JHxNsj2qCntE/MvSdxA1ZmDkvAi7FIU2LbTaYGFLpOOJ8D6TErm+kDHxrXF3VUOl4y6sv X-Received: by 2002:a05:6a21:3601:b0:106:999f:64df with SMTP id yg1-20020a056a21360100b00106999f64dfmr1059777pzb.58.1686316000899; Fri, 09 Jun 2023 06:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686316000; cv=none; d=google.com; s=arc-20160816; b=wh1ZqI69Rez4Ny3xkHkCuXOSgk6w0AjK1iwkpdvzPNa3QMtvPg17pN7hf+39siVlB6 rTNBtGZZapBwiiyjZNISFUcRoLc7QIaBzmMRjaNvDwEE1BJyXRpN5M/gBt6lJBGrf6OT aZvUXE/SmulPEyz8wObA7B7NOl7zakPKL3SpG9Op881NS3KdQSil/GjcN2scfu57cDPs hyH2g3H8b3lZhX7skCB6/sI/6m9o9v8I6m41xt+hMnMl+nKlYCh9cqsj20DqqNkTpJHY Tv2Ev3BSICK96tqvCGKJ/+ETObH/jP1IsaUcFyDTbhT7IEOP5AqW7d9UnC06fXT+lIbj HRQg== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jeTFc7Rk2Z9XACFp0Jrlj031wVVKzSKpsl9/iy0GIFA=; b=StRJQHE0wV0Uw8G6bTj5f4XY4dhjpQpOhsQPVjTTUrdISsSUmhAMwRxTrpFUNrNOKC xRFYFWj0SFOAPwp6By1nSo7FLvKep1ApObsAfJOHF4u7Br4QY2DElg+w7jBB/uiQ3TPu zGm7If1a1f9Kx5LNDbNoHrgWBeDdidUyU28Z+9vzRC5To+9K0U6KqHWQlQsYubYUEi1T ZfKFlhYj06WJYeUQWKkDKgl3Ey8h62x5t3tbPItVwZafGFyMjDU9+5ClL6RvCgJEl6uu S0Z70nyQb47R807A83K+XfmZPXuWhlQ3hqaYYV01IVB7Yh6vPwhLJl5+BfrXzitYXylt sHiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=upjyEocq; 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 bm18-20020a656e92000000b0053074c54c3fsi2703131pgb.868.2023.06.09.06.06.25; Fri, 09 Jun 2023 06:06:40 -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=upjyEocq; 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 S240587AbjFIMvb (ORCPT + 99 others); Fri, 9 Jun 2023 08:51:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240930AbjFIMu4 (ORCPT ); Fri, 9 Jun 2023 08:50:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41CBDD; Fri, 9 Jun 2023 05:50:55 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3C293657CE; Fri, 9 Jun 2023 12:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95034C433D2; Fri, 9 Jun 2023 12:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686315054; bh=sciXKJTuFnUY9nWrxAAZ1qAJ1Cp4ErdvEEiDAODqg/U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=upjyEocqQzinZ+OVD6Khhwt5MbyOvuFlp/sJ6q2j6RvVpNlRvipHKI/hIrIMqgYBh l0EIrvQ8CVdV7O7ucm8ag0cZDr4zw8NGa2wTrjrkUxskKo/cb+oqW8dI3ZvsQ++u5z hqGm/E6z5CoM1hJrIgICg4S7HJvHENSxp9LYAfwLva2tkkBqJjgQ+eRfpH7K76TpjX fkancV079fcU3zROG4KRpBxdmlFg8fJdHC+A8HJdEXMylLCuj+qceg9W78aFJ5KfAL wJc5U12Ra6wom5m6Zq4maYyF2JafYOD8LtC23iIBSL+R6yE7LtMCyziYVObahi/C63 rjGOk8B2rKEwg== From: Jeff Layton To: Christian Brauner , Al Viro , Brad Warrum , Ritu Agarwal , Arnd Bergmann , Greg Kroah-Hartman , Ian Kent , "Tigran A. Aivazian" , Jeremy Kerr , Ard Biesheuvel , Namjae Jeon , Sungjong Seo , Bob Peterson , Andreas Gruenbacher , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Ruihan Li , Suren Baghdasaryan , Sebastian Reichel , Wolfram Sang , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org, cluster-devel@redhat.com, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: [PATCH 8/9] apparmor: update ctime whenever the mtime changes on an inode Date: Fri, 9 Jun 2023 08:50:22 -0400 Message-Id: <20230609125023.399942-9-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230609125023.399942-1-jlayton@kernel.org> References: <20230609125023.399942-1-jlayton@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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 Signed-off-by: Jeff Layton --- security/apparmor/apparmorfs.c | 7 +++++-- security/apparmor/policy_unpack.c | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index db7a51acf9db..c06053718836 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1554,8 +1554,11 @@ void __aafs_profile_migrate_dents(struct aa_profile *old, for (i = 0; i < AAFS_PROF_SIZEOF; i++) { new->dents[i] = old->dents[i]; - if (new->dents[i]) - new->dents[i]->d_inode->i_mtime = current_time(new->dents[i]->d_inode); + if (new->dents[i]) { + struct inode *inode = d_inode(new->dents[i]); + + inode->i_mtime = inode->i_ctime = current_time(inode); + } old->dents[i] = NULL; } } diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index cf2ceec40b28..48a97c1800b9 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -86,10 +86,13 @@ void __aa_loaddata_update(struct aa_loaddata *data, long revision) data->revision = revision; if ((data->dents[AAFS_LOADDATA_REVISION])) { - d_inode(data->dents[AAFS_LOADDATA_DIR])->i_mtime = - current_time(d_inode(data->dents[AAFS_LOADDATA_DIR])); - d_inode(data->dents[AAFS_LOADDATA_REVISION])->i_mtime = - current_time(d_inode(data->dents[AAFS_LOADDATA_REVISION])); + struct inode *inode; + + inode = d_inode(data->dents[AAFS_LOADDATA_DIR]); + inode->i_mtime = inode->i_ctime = current_time(inode); + + inode = d_inode(data->dents[AAFS_LOADDATA_REVISION]); + inode->i_mtime = inode->i_ctime = current_time(inode); } } -- 2.40.1