From f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Wed, 31 Jan 2024 01:04:47 +0000 Subject: [PATCH] add driver 5G --- kernel/include/linux/fsverity.h | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/kernel/include/linux/fsverity.h b/kernel/include/linux/fsverity.h index eb490bd..19c118e 100644 --- a/kernel/include/linux/fsverity.h +++ b/kernel/include/linux/fsverity.h @@ -115,8 +115,13 @@ static inline struct fsverity_info *fsverity_get_info(const struct inode *inode) { - /* pairs with the cmpxchg() in fsverity_set_info() */ - return READ_ONCE(inode->i_verity_info); + /* + * Pairs with the cmpxchg_release() in fsverity_set_info(). + * I.e., another task may publish ->i_verity_info concurrently, + * executing a RELEASE barrier. We need to use smp_load_acquire() here + * to safely ACQUIRE the memory the other task published. + */ + return smp_load_acquire(&inode->i_verity_info); } /* enable.c */ @@ -132,6 +137,10 @@ int fsverity_file_open(struct inode *inode, struct file *filp); int fsverity_prepare_setattr(struct dentry *dentry, struct iattr *attr); void fsverity_cleanup_inode(struct inode *inode); + +/* read_metadata.c */ + +int fsverity_ioctl_read_metadata(struct file *filp, const void __user *uarg); /* verify.c */ @@ -178,6 +187,14 @@ { } +/* read_metadata.c */ + +static inline int fsverity_ioctl_read_metadata(struct file *filp, + const void __user *uarg) +{ + return -EOPNOTSUPP; +} + /* verify.c */ static inline bool fsverity_verify_page(struct page *page) @@ -218,11 +235,11 @@ #ifdef CONFIG_FS_VERITY_BUILTIN_SIGNATURES int __fsverity_verify_signature(const struct inode *inode, const u8 *signature, - u32 sig_size, const u8 *file_digest, + size_t sig_size, const u8 *file_digest, unsigned int digest_algorithm); #else /* !CONFIG_FS_VERITY_BUILTIN_SIGNATURES */ static inline int __fsverity_verify_signature(const struct inode *inode, - const u8 *signature, u32 sig_size, + const u8 *signature, size_t sig_size, const u8 *file_digest, unsigned int digest_algorithm) { -- Gitblit v1.6.2