hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/fsverity.h
....@@ -115,8 +115,13 @@
115115
116116 static inline struct fsverity_info *fsverity_get_info(const struct inode *inode)
117117 {
118
- /* pairs with the cmpxchg() in fsverity_set_info() */
119
- return READ_ONCE(inode->i_verity_info);
118
+ /*
119
+ * Pairs with the cmpxchg_release() in fsverity_set_info().
120
+ * I.e., another task may publish ->i_verity_info concurrently,
121
+ * executing a RELEASE barrier. We need to use smp_load_acquire() here
122
+ * to safely ACQUIRE the memory the other task published.
123
+ */
124
+ return smp_load_acquire(&inode->i_verity_info);
120125 }
121126
122127 /* enable.c */
....@@ -132,6 +137,10 @@
132137 int fsverity_file_open(struct inode *inode, struct file *filp);
133138 int fsverity_prepare_setattr(struct dentry *dentry, struct iattr *attr);
134139 void fsverity_cleanup_inode(struct inode *inode);
140
+
141
+/* read_metadata.c */
142
+
143
+int fsverity_ioctl_read_metadata(struct file *filp, const void __user *uarg);
135144
136145 /* verify.c */
137146
....@@ -178,6 +187,14 @@
178187 {
179188 }
180189
190
+/* read_metadata.c */
191
+
192
+static inline int fsverity_ioctl_read_metadata(struct file *filp,
193
+ const void __user *uarg)
194
+{
195
+ return -EOPNOTSUPP;
196
+}
197
+
181198 /* verify.c */
182199
183200 static inline bool fsverity_verify_page(struct page *page)
....@@ -218,11 +235,11 @@
218235
219236 #ifdef CONFIG_FS_VERITY_BUILTIN_SIGNATURES
220237 int __fsverity_verify_signature(const struct inode *inode, const u8 *signature,
221
- u32 sig_size, const u8 *file_digest,
238
+ size_t sig_size, const u8 *file_digest,
222239 unsigned int digest_algorithm);
223240 #else /* !CONFIG_FS_VERITY_BUILTIN_SIGNATURES */
224241 static inline int __fsverity_verify_signature(const struct inode *inode,
225
- const u8 *signature, u32 sig_size,
242
+ const u8 *signature, size_t sig_size,
226243 const u8 *file_digest,
227244 unsigned int digest_algorithm)
228245 {