Skip to content

Commit

Permalink
Use non-idmapped mount idmap
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexScherba16 committed Jun 14, 2024
1 parent 0abf1c0 commit e9e8df1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bio_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void dattobd_set_bio_ops(struct bio *bio, req_op_t op, unsigned op_flags)
}
#endif

#ifndef HAVE_BIO_BI_OPF
#if !defined(HAVE_BIO_BI_OPF) && defined(HAVE_ENUM_REQ_OP)
void dattobd_set_bio_ops(struct bio *bio, req_op_t op, unsigned op_flags)
{
bio->bi_rw = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/configure-tests/feature-tests/gd_owns_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
MODULE_LICENSE("GPL");

static inline void dummy(void){
struct gendisk *sd_gd; = NULL;
struct gendisk *sd_gd = NULL;
set_bit(GD_OWNS_QUEUE, &sd_gd->state);
}
14 changes: 14 additions & 0 deletions src/configure-tests/feature-tests/user_namespace_args_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-only

/*
* Copyright (C) 2024 Datto Inc.
*/

#include "includes.h"

MODULE_LICENSE("GPL");

static inline void dummy(void){
struct mnt_idmap* map = &nop_mnt_idmap ;
(void)vfs_unlink(map, NULL, NULL, NULL);
}
1 change: 1 addition & 0 deletions src/configure-tests/symbol-tests
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ vm_area_alloc
vm_area_free
insert_vm_struct
vm_area_cachep
get_active_super
4 changes: 4 additions & 0 deletions src/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ static int dattobd_do_truncate(struct dentry *dentry, loff_t length,
#elif defined HAVE_USER_NAMESPACE_ARGS
//#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)
ret = notify_change(&init_user_ns, dentry, &newattrs, NULL);
#elif defined HAVE_USER_NAMESPACE_ARGS_2
ret = notify_change(&nop_mnt_idmap, dentry, &newattrs, NULL);
#else
ret = notify_change(dentry, &newattrs, NULL);
#endif
Expand Down Expand Up @@ -904,6 +906,8 @@ int __file_unlink(struct file *filp, int close, int force)
#elif defined HAVE_USER_NAMESPACE_ARGS
//#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)
ret = vfs_unlink(&init_user_ns, dir_inode, file_dentry, NULL);
#elif defined HAVE_USER_NAMESPACE_ARGS_2
ret = vfs_unlink(file_mnt_idmap(filp), dir_inode, file_dentry, NULL);
#else
ret = vfs_unlink(dir_inode, file_dentry, NULL);
#endif
Expand Down

0 comments on commit e9e8df1

Please sign in to comment.