* [PATCH v2 05/92] apparmor: update ctime whenever the mtime changes on an inode
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
@ 2023-07-05 19:00 ` Jeff Layton
2023-07-05 19:01 ` [PATCH v2 89/92] apparmor: convert to ctime accessor functions Jeff Layton
2023-07-05 19:01 ` [PATCH v2 90/92] security: " Jeff Layton
2 siblings, 0 replies; 5+ messages in thread
From: Jeff Layton @ 2023-07-05 19:00 UTC (permalink / raw)
To: Christian Brauner, John Johansen, Paul Moore, James Morris,
Serge E. Hallyn
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel, apparmor,
linux-security-module
In general, when updating the mtime on an inode, one must also update
the ctime. Add the missing ctime updates.
Acked-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
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 8e634fde35a5..3d0d370d6ffd 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 694fb7a09962..ed180722a833 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.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 89/92] apparmor: convert to ctime accessor functions
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
2023-07-05 19:00 ` [PATCH v2 05/92] apparmor: update ctime whenever the mtime changes on an inode Jeff Layton
@ 2023-07-05 19:01 ` Jeff Layton
2023-07-06 14:57 ` Jan Kara
2023-07-05 19:01 ` [PATCH v2 90/92] security: " Jeff Layton
2 siblings, 1 reply; 5+ messages in thread
From: Jeff Layton @ 2023-07-05 19:01 UTC (permalink / raw)
To: Christian Brauner, John Johansen, Paul Moore, James Morris,
Serge E. Hallyn
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel, apparmor,
linux-security-module
In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
security/apparmor/apparmorfs.c | 6 +++---
security/apparmor/policy_unpack.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 3d0d370d6ffd..7dbd0a5aaeeb 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -226,7 +226,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = iops ? iops : &simple_dir_inode_operations;
@@ -1557,7 +1557,7 @@ void __aafs_profile_migrate_dents(struct aa_profile *old,
if (new->dents[i]) {
struct inode *inode = d_inode(new->dents[i]);
- inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode_set_ctime_current(inode);
}
old->dents[i] = NULL;
}
@@ -2546,7 +2546,7 @@ static int aa_mk_null_file(struct dentry *parent)
inode->i_ino = get_next_ino();
inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
MKDEV(MEM_MAJOR, 3));
d_instantiate(dentry, inode);
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index ed180722a833..8b8846073e14 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -89,10 +89,10 @@ void __aa_loaddata_update(struct aa_loaddata *data, long revision)
struct inode *inode;
inode = d_inode(data->dents[AAFS_LOADDATA_DIR]);
- inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode_set_ctime_current(inode);
inode = d_inode(data->dents[AAFS_LOADDATA_REVISION]);
- inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode_set_ctime_current(inode);
}
}
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 90/92] security: convert to ctime accessor functions
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
2023-07-05 19:00 ` [PATCH v2 05/92] apparmor: update ctime whenever the mtime changes on an inode Jeff Layton
2023-07-05 19:01 ` [PATCH v2 89/92] apparmor: convert to ctime accessor functions Jeff Layton
@ 2023-07-05 19:01 ` Jeff Layton
2023-07-06 14:57 ` Jan Kara
2 siblings, 1 reply; 5+ messages in thread
From: Jeff Layton @ 2023-07-05 19:01 UTC (permalink / raw)
To: Christian Brauner, Paul Moore, James Morris, Serge E. Hallyn
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel,
linux-security-module
In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
security/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/inode.c b/security/inode.c
index 6c326939750d..3aa75fffa8c9 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -145,7 +145,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 89/92] apparmor: convert to ctime accessor functions
2023-07-05 19:01 ` [PATCH v2 89/92] apparmor: convert to ctime accessor functions Jeff Layton
@ 2023-07-06 14:57 ` Jan Kara
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2023-07-06 14:57 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, John Johansen, Paul Moore, James Morris,
Serge E. Hallyn, Al Viro, Jan Kara, linux-fsdevel, linux-kernel,
apparmor, linux-security-module
On Wed 05-07-23 15:01:54, Jeff Layton wrote:
> In later patches, we're going to change how the inode's ctime field is
> used. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> security/apparmor/apparmorfs.c | 6 +++---
> security/apparmor/policy_unpack.c | 4 ++--
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 3d0d370d6ffd..7dbd0a5aaeeb 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -226,7 +226,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
>
> inode->i_ino = get_next_ino();
> inode->i_mode = mode;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
> inode->i_private = data;
> if (S_ISDIR(mode)) {
> inode->i_op = iops ? iops : &simple_dir_inode_operations;
> @@ -1557,7 +1557,7 @@ void __aafs_profile_migrate_dents(struct aa_profile *old,
> if (new->dents[i]) {
> struct inode *inode = d_inode(new->dents[i]);
>
> - inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode_set_ctime_current(inode);
> }
> old->dents[i] = NULL;
> }
> @@ -2546,7 +2546,7 @@ static int aa_mk_null_file(struct dentry *parent)
>
> inode->i_ino = get_next_ino();
> inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
> init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
> MKDEV(MEM_MAJOR, 3));
> d_instantiate(dentry, inode);
> diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
> index ed180722a833..8b8846073e14 100644
> --- a/security/apparmor/policy_unpack.c
> +++ b/security/apparmor/policy_unpack.c
> @@ -89,10 +89,10 @@ void __aa_loaddata_update(struct aa_loaddata *data, long revision)
> struct inode *inode;
>
> inode = d_inode(data->dents[AAFS_LOADDATA_DIR]);
> - inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode_set_ctime_current(inode);
>
> inode = d_inode(data->dents[AAFS_LOADDATA_REVISION]);
> - inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode_set_ctime_current(inode);
> }
> }
>
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 90/92] security: convert to ctime accessor functions
2023-07-05 19:01 ` [PATCH v2 90/92] security: " Jeff Layton
@ 2023-07-06 14:57 ` Jan Kara
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2023-07-06 14:57 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, Paul Moore, James Morris, Serge E. Hallyn,
Al Viro, Jan Kara, linux-fsdevel, linux-kernel,
linux-security-module
On Wed 05-07-23 15:01:55, Jeff Layton wrote:
> In later patches, we're going to change how the inode's ctime field is
> used. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Acked-by: Paul Moore <paul@paul-moore.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> security/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/inode.c b/security/inode.c
> index 6c326939750d..3aa75fffa8c9 100644
> --- a/security/inode.c
> +++ b/security/inode.c
> @@ -145,7 +145,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
>
> inode->i_ino = get_next_ino();
> inode->i_mode = mode;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
> inode->i_private = data;
> if (S_ISDIR(mode)) {
> inode->i_op = &simple_dir_inode_operations;
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-06 14:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230705185755.579053-1-jlayton@kernel.org>
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
2023-07-05 19:00 ` [PATCH v2 05/92] apparmor: update ctime whenever the mtime changes on an inode Jeff Layton
2023-07-05 19:01 ` [PATCH v2 89/92] apparmor: convert to ctime accessor functions Jeff Layton
2023-07-06 14:57 ` Jan Kara
2023-07-05 19:01 ` [PATCH v2 90/92] security: " Jeff Layton
2023-07-06 14:57 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).