diff options
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile.patch | 19 | ||||
-rw-r--r-- | PKGBUILD | 56 | ||||
-rw-r--r-- | dkms.conf | 10 | ||||
-rw-r--r-- | kernel-5.12-backport.patch | 424 | ||||
-rw-r--r-- | kernel-5.14-backport.patch | 16 |
7 files changed, 554 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..b4a61ea5afac --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,25 @@ +pkgbase = ntfs3-dkms-git + pkgdesc = NTFS read-write driver GPL implementation by Paragon Software. Current version works with NTFS (including v3.1), normal/compressed/sparse files and supports journal replaying. + pkgver = 27.0.0 + pkgrel = 1 + url = https://github.com/Paragon-Software-Group/linux-ntfs3 + arch = any + license = GPL2 + depends = dkms + provides = NTFS3-MODULE + provides = ntfs3=27.0.0 + provides = ntfs3-dkms=27.0.0 + conflicts = ntfs3 + options = !strip + source = Makefile.patch + source = dkms.conf + source = kernel-5.12-backport.patch + source = kernel-5.14-backport.patch + source = ntfs3-v27.0.0.patch::https://github.com/torvalds/linux/compare/master...Paragon-Software-Group:master.diff + sha512sums = 533c249f0f6bd4833faf02d0d92ca1b5802a49afc5feb2e46a7d37275cfca7896db76cd83593f4f313977d278a9a7e92eda550667be2b93910c49cfb68ead4fb + sha512sums = ac00adb4a6d7fc685c39af054474631c930455e9ad0838338e6b3622b72451e81397506866b83a4a51dd0e34ed7752963c0fed9e8b017da5122e0dca3d345fb6 + sha512sums = 374c6fa524defb5dcac093493bc7526e43ca9fe07602357fb51df4a26b02280ba4f2d764d3ba2ba2b32d5318ef466f3e0b6cbfdad1cdac0b04c31e8543114e33 + sha512sums = 081b19b271ed89c47a9306874827a0c15feba6dda6d7c8a085f634a72a6691a78fdeccf47488ed141b979f7bfbf3df2d117301f09ba2da8416449460d4711d34 + sha512sums = SKIP + +pkgname = ntfs3-dkms-git diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..f446e93fa35e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +pkg/ +src/ +ntfs3-*.patch +*.pkg.tar.*
\ No newline at end of file diff --git a/Makefile.patch b/Makefile.patch new file mode 100644 index 000000000000..929ee32e3419 --- /dev/null +++ b/Makefile.patch @@ -0,0 +1,19 @@ +--- Makefile ++++ Makefile +@@ -33,4 +33,13 @@ + decompress_common.o \ + lzx_decompress.o \ + xpress_decompress.o \ +- ) +\ No newline at end of file ++ ) ++ ++ccflags-$(CONFIG_NTFS3_LZX_XPRESS) += -DCONFIG_NTFS3_LZX_XPRESS ++ccflags-$(CONFIG_NTFS3_FS_POSIX_ACL) += -DCONFIG_NTFS3_FS_POSIX_ACL ++ ++all: ++ make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules ++ ++clean: ++ make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean +\ No newline at end of file diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..a8a1e7f3aa65 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,56 @@ +pkgname=ntfs3-dkms-git +_pkgver=27.0.0 +pkgver=27.0.0.96b1804 +pkgrel=1 +pkgdesc="NTFS read-write driver GPL implementation by Paragon Software. Current version works with NTFS (including v3.1), normal/compressed/sparse files and supports journal replaying." +arch=('any') +url='https://github.com/Paragon-Software-Group/linux-ntfs3' +license=('GPL2') +depends=('dkms') +provides=('NTFS3-MODULE' "ntfs3=${_pkgver}" "ntfs3-dkms=${_pkgver}") +conflicts=('ntfs3') +options=('!strip') + +source=( + Makefile.patch + dkms.conf + kernel-5.12-backport.patch + kernel-5.14-backport.patch + "ntfs3-v${_pkgver}.patch::https://github.com/torvalds/linux/compare/master...Paragon-Software-Group:master.diff" +) + +sha512sums=( + '533c249f0f6bd4833faf02d0d92ca1b5802a49afc5feb2e46a7d37275cfca7896db76cd83593f4f313977d278a9a7e92eda550667be2b93910c49cfb68ead4fb' + 'ac00adb4a6d7fc685c39af054474631c930455e9ad0838338e6b3622b72451e81397506866b83a4a51dd0e34ed7752963c0fed9e8b017da5122e0dca3d345fb6' + '374c6fa524defb5dcac093493bc7526e43ca9fe07602357fb51df4a26b02280ba4f2d764d3ba2ba2b32d5318ef466f3e0b6cbfdad1cdac0b04c31e8543114e33' + '081b19b271ed89c47a9306874827a0c15feba6dda6d7c8a085f634a72a6691a78fdeccf47488ed141b979f7bfbf3df2d117301f09ba2da8416449460d4711d34' + 'SKIP' +) + +pkgver() { + local sha=$(curl -H "Accept: text/vnd.github.VERSION.sha" "https://api.github.com/repos/Paragon-Software-Group/linux-ntfs3/commits/master") + echo "${_pkgver}.${sha:0:7}" +} + +prepare() { + mkdir -p "${_pkgver}" + cd "${_pkgver}" + + patch -p3 -t -N -i "${srcdir}/ntfs3-v${pkgver}.patch" || true + + patch -p0 -N -i "${srcdir}/Makefile.patch" + + # For testing + # patch -p1 -N -i "${srcdir}/kernel-5.12-backport.patch" + # patch -p1 -N -i "${srcdir}/kernel-5.14-backport.patch" +} + +package() { + local dest="${pkgdir}/usr/src/ntfs3-${_pkgver}" + mkdir -p "${dest}" + cd "${dest}" + cp -r "${srcdir}/${_pkgver}/"* ./ + cp "${srcdir}/dkms.conf" ./ + mkdir -p "./patches" + cp "${srcdir}/kernel-"*.patch "./patches/" +} diff --git a/dkms.conf b/dkms.conf new file mode 100644 index 000000000000..9c7531ed9183 --- /dev/null +++ b/dkms.conf @@ -0,0 +1,10 @@ +PACKAGE_NAME="ntfs3" +PACKAGE_VERSION="27.0.0" +BUILT_MODULE_NAME[0]="ntfs3" +DEST_MODULE_LOCATION[0]="/kernel/fs/ntfs3" +AUTOINSTALL="yes" +MAKE[0]="KVERSION=$kernelver CONFIG_NTFS3_FS=m CONFIG_NTFS3_LZX_XPRESS=y CONFIG_NTFS3_FS_POSIX_ACL=y make KDIR=$kernel_source_dir" +PATCH[0]="kernel-5.12-backport.patch" +PATCH_MATCH[0]="^([0-4]\.|5\.[0-9]\.|5\.1[0-1]\.).*" +PATCH[1]="kernel-5.14-backport.patch" +PATCH_MATCH[1]="^([0-4]\.|5\.[0-9]\.|5\.1[0-3]\.).*" diff --git a/kernel-5.12-backport.patch b/kernel-5.12-backport.patch new file mode 100644 index 000000000000..1a0c273854be --- /dev/null +++ b/kernel-5.12-backport.patch @@ -0,0 +1,424 @@ +--- a/file.c ++++ b/file.c +@@ -76,7 +76,7 @@ + /* + * inode_operations::getattr + */ +-int ntfs_getattr(struct user_namespace *mnt_userns, const struct path *path, ++int ntfs_getattr(const struct path *path, + struct kstat *stat, u32 request_mask, u32 flags) + { + struct inode *inode = d_inode(path->dentry); +@@ -90,7 +90,7 @@ + + stat->attributes_mask |= STATX_ATTR_COMPRESSED | STATX_ATTR_ENCRYPTED; + +- generic_fillattr(mnt_userns, inode, stat); ++ generic_fillattr(inode, stat); + + stat->result_mask |= STATX_BTIME; + stat->btime = ni->i_crtime; +@@ -614,7 +614,7 @@ + /* + * inode_operations::setattr + */ +-int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, ++int ntfs3_setattr(struct dentry *dentry, + struct iattr *attr) + { + struct super_block *sb = dentry->d_sb; +@@ -633,7 +633,7 @@ + ia_valid = attr->ia_valid; + } + +- err = setattr_prepare(mnt_userns, dentry, attr); ++ err = setattr_prepare(dentry, attr); + if (err) + goto out; + +@@ -658,10 +658,10 @@ + ni->ni_flags |= NI_FLAG_UPDATE_PARENT; + } + +- setattr_copy(mnt_userns, inode, attr); ++ setattr_copy(inode, attr); + + if (mode != inode->i_mode) { +- err = ntfs_acl_chmod(mnt_userns, inode); ++ err = ntfs_acl_chmod(inode); + if (err) + goto out; + + +--- a/fsntfs.c ++++ b/fsntfs.c +@@ -1620,7 +1620,7 @@ + lbo = (u64)lcn << cluster_bits; + len = (u64)clen << cluster_bits; + new_bio: +- new = ntfs_alloc_bio(BIO_MAX_VECS); ++ new = ntfs_alloc_bio(BIO_MAX_PAGES); + if (!new) { + err = -ENOMEM; + break; + +--- a/inode.c ++++ b/inode.c +@@ -1176,7 +1176,7 @@ + return ERR_PTR(err); + } + +-struct inode *ntfs_create_inode(struct user_namespace *mnt_userns, ++struct inode *ntfs_create_inode( + struct inode *dir, struct dentry *dentry, + const struct cpu_str *uni, umode_t mode, + dev_t dev, const char *symname, u32 size, +@@ -1577,7 +1577,7 @@ + + #ifdef CONFIG_NTFS3_FS_POSIX_ACL + if (!is_link && (sb->s_flags & SB_POSIXACL)) { +- err = ntfs_init_acl(mnt_userns, inode, dir); ++ err = ntfs_init_acl(inode, dir); + if (err) + goto out6; + } else + +--- a/namei.c ++++ b/namei.c +@@ -102,7 +102,7 @@ + * + * inode_operations::create + */ +-static int ntfs_create(struct user_namespace *mnt_userns, struct inode *dir, ++static int ntfs_create(struct inode *dir, + struct dentry *dentry, umode_t mode, bool excl) + { + struct ntfs_inode *ni = ntfs_i(dir); +@@ -110,7 +110,7 @@ + + ni_lock_dir(ni); + +- inode = ntfs_create_inode(mnt_userns, dir, dentry, NULL, S_IFREG | mode, ++ inode = ntfs_create_inode(dir, dentry, NULL, S_IFREG | mode, + 0, NULL, 0, excl, NULL); + + ni_unlock(ni); +@@ -184,7 +184,7 @@ + * + * inode_operations::symlink + */ +-static int ntfs_symlink(struct user_namespace *mnt_userns, struct inode *dir, ++static int ntfs_symlink(struct inode *dir, + struct dentry *dentry, const char *symname) + { + u32 size = strlen(symname); +@@ -193,7 +193,7 @@ + + ni_lock_dir(ni); + +- inode = ntfs_create_inode(mnt_userns, dir, dentry, NULL, S_IFLNK | 0777, ++ inode = ntfs_create_inode(dir, dentry, NULL, S_IFLNK | 0777, + 0, symname, size, 0, NULL); + + ni_unlock(ni); +@@ -206,7 +206,7 @@ + * + * inode_operations::mkdir + */ +-static int ntfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir, ++static int ntfs_mkdir(struct inode *dir, + struct dentry *dentry, umode_t mode) + { + struct inode *inode; +@@ -214,7 +214,7 @@ + + ni_lock_dir(ni); + +- inode = ntfs_create_inode(mnt_userns, dir, dentry, NULL, S_IFDIR | mode, ++ inode = ntfs_create_inode(dir, dentry, NULL, S_IFDIR | mode, + 0, NULL, -1, 0, NULL); + + ni_unlock(ni); +@@ -246,7 +246,7 @@ + * + * inode_operations::rename + */ +-static int ntfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, ++static int ntfs_rename(struct inode *old_dir, + struct dentry *old_dentry, struct inode *new_dir, + struct dentry *new_dentry, u32 flags) + { +@@ -520,7 +520,7 @@ + + /*fnd contains tree's path to insert to*/ + /* TODO: init_user_ns? */ +- inode = ntfs_create_inode(&init_user_ns, dir, dentry, uni, mode, 0, ++ inode = ntfs_create_inode(dir, dentry, uni, mode, 0, + NULL, 0, excl, fnd); + err = IS_ERR(inode) ? PTR_ERR(inode) + : finish_open(file, dentry, ntfs_file_open); + +--- a/ntfs_fs.h ++++ b/ntfs_fs.h +@@ -453,11 +453,11 @@ + extern const struct file_operations ntfs_dir_operations; + + /* globals from file.c*/ +-int ntfs_getattr(struct user_namespace *mnt_userns, const struct path *path, ++int ntfs_getattr(const struct path *path, + struct kstat *stat, u32 request_mask, u32 flags); + void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn, + CLST len); +-int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, ++int ntfs3_setattr(struct dentry *dentry, + struct iattr *attr); + int ntfs_file_open(struct inode *inode, struct file *file); + int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, +@@ -644,7 +644,7 @@ + int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, + struct inode *i2); + int inode_write_data(struct inode *inode, const void *data, size_t bytes); +-struct inode *ntfs_create_inode(struct user_namespace *mnt_userns, ++struct inode *ntfs_create_inode( + struct inode *dir, struct dentry *dentry, + const struct cpu_str *uni, umode_t mode, + dev_t dev, const char *symname, u32 size, +@@ -784,17 +784,17 @@ + /* globals from xattr.c */ + #ifdef CONFIG_NTFS3_FS_POSIX_ACL + struct posix_acl *ntfs_get_acl(struct inode *inode, int type); +-int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode, ++int ntfs_set_acl(struct inode *inode, + struct posix_acl *acl, int type); +-int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode, ++int ntfs_init_acl(struct inode *inode, + struct inode *dir); + #else + #define ntfs_get_acl NULL + #define ntfs_set_acl NULL + #endif + +-int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode); +-int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode, ++int ntfs_acl_chmod(struct inode *inode); ++int ntfs_permission(struct inode *inode, + int mask); + ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size); + extern const struct xattr_handler *ntfs_xattr_handlers[]; + +--- a/super.c ++++ b/super.c +@@ -542,10 +542,10 @@ + + if (opts->uid) + seq_printf(m, ",uid=%u", +- from_kuid_munged(user_ns, opts->fs_uid)); ++ from_kuid_munged(&init_user_ns, opts->fs_uid)); + if (opts->gid) + seq_printf(m, ",gid=%u", +- from_kgid_munged(user_ns, opts->fs_gid)); ++ from_kgid_munged(&init_user_ns, opts->fs_gid)); + if (opts->fmask) + seq_printf(m, ",fmask=%04o", ~opts->fs_fmask_inv); + if (opts->dmask) + +--- a/xattr.c ++++ b/xattr.c +@@ -473,7 +473,7 @@ + kfree(acl); + } + +-static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns, ++static struct posix_acl *ntfs_get_acl_ex( + struct inode *inode, int type, + int locked) + { +@@ -509,7 +509,7 @@ + + /* Translate extended attribute to acl */ + if (err > 0) { +- acl = posix_acl_from_xattr(mnt_userns, buf, err); ++ acl = posix_acl_from_xattr(&init_user_ns, buf, err); + if (!IS_ERR(acl)) + set_cached_acl(inode, type, acl); + } else { +@@ -529,10 +529,10 @@ + struct posix_acl *ntfs_get_acl(struct inode *inode, int type) + { + /* TODO: init_user_ns? */ +- return ntfs_get_acl_ex(&init_user_ns, inode, type, 0); ++ return ntfs_get_acl_ex(inode, type, 0); + } + +-static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, ++static noinline int ntfs_set_acl_ex( + struct inode *inode, struct posix_acl *acl, + int type, int locked) + { +@@ -590,7 +590,7 @@ + if (!value) + return -ENOMEM; + +- err = posix_acl_to_xattr(mnt_userns, acl, value, size); ++ err = posix_acl_to_xattr(&init_user_ns, acl, value, size); + if (err) + goto out; + +@@ -614,13 +614,13 @@ + * + * inode_operations::set_acl + */ +-int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode, ++int ntfs_set_acl(struct inode *inode, + struct posix_acl *acl, int type) + { +- return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0); ++ return ntfs_set_acl_ex(inode, acl, type, 0); + } + +-static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns, ++static int ntfs_xattr_get_acl( + struct inode *inode, int type, void *buffer, + size_t size) + { +@@ -637,13 +637,13 @@ + if (!acl) + return -ENODATA; + +- err = posix_acl_to_xattr(mnt_userns, acl, buffer, size); ++ err = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); + ntfs_posix_acl_release(acl); + + return err; + } + +-static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns, ++static int ntfs_xattr_set_acl( + struct inode *inode, int type, const void *value, + size_t size) + { +@@ -653,23 +653,23 @@ + if (!(inode->i_sb->s_flags & SB_POSIXACL)) + return -EOPNOTSUPP; + +- if (!inode_owner_or_capable(mnt_userns, inode)) ++ if (!inode_owner_or_capable(inode)) + return -EPERM; + + if (!value) + return 0; + +- acl = posix_acl_from_xattr(mnt_userns, value, size); ++ acl = posix_acl_from_xattr(&init_user_ns, value, size); + if (IS_ERR(acl)) + return PTR_ERR(acl); + + if (acl) { +- err = posix_acl_valid(mnt_userns, acl); ++ err = posix_acl_valid(&init_user_ns, acl); + if (err) + goto release_and_out; + } + +- err = ntfs_set_acl(mnt_userns, inode, acl, type); ++ err = ntfs_set_acl(inode, acl, type); + + release_and_out: + ntfs_posix_acl_release(acl); +@@ -679,7 +679,7 @@ + /* + * Initialize the ACLs of a new inode. Called from ntfs_create_inode. + */ +-int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode, ++int ntfs_init_acl(struct inode *inode, + struct inode *dir) + { + struct posix_acl *default_acl, *acl; +@@ -691,7 +691,7 @@ + */ + inode->i_default_acl = NULL; + +- default_acl = ntfs_get_acl_ex(mnt_userns, dir, ACL_TYPE_DEFAULT, 1); ++ default_acl = ntfs_get_acl_ex(dir, ACL_TYPE_DEFAULT, 1); + + if (!default_acl || default_acl == ERR_PTR(-EOPNOTSUPP)) { + inode->i_mode &= ~current_umask(); +@@ -719,13 +719,13 @@ + } + + if (default_acl) +- err = ntfs_set_acl_ex(mnt_userns, inode, default_acl, ++ err = ntfs_set_acl_ex(inode, default_acl, + ACL_TYPE_DEFAULT, 1); + + if (!acl) + inode->i_acl = NULL; + else if (!err) +- err = ntfs_set_acl_ex(mnt_userns, inode, acl, ACL_TYPE_ACCESS, ++ err = ntfs_set_acl_ex(inode, acl, ACL_TYPE_ACCESS, + 1); + + posix_acl_release(acl); +@@ -742,7 +742,7 @@ + * + * helper for 'ntfs3_setattr' + */ +-int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode) ++int ntfs_acl_chmod(struct inode *inode) + { + struct super_block *sb = inode->i_sb; + +@@ -752,7 +752,7 @@ + if (S_ISLNK(inode->i_mode)) + return -EOPNOTSUPP; + +- return posix_acl_chmod(mnt_userns, inode, inode->i_mode); ++ return posix_acl_chmod(inode, inode->i_mode); + } + + /* +@@ -760,7 +760,7 @@ + * + * inode_operations::permission + */ +-int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode, ++int ntfs_permission(struct inode *inode, + int mask) + { + if (ntfs_sb(inode->i_sb)->options.no_acs_rules) { +@@ -768,7 +768,7 @@ + return 0; + } + +- return generic_permission(mnt_userns, inode, mask); ++ return generic_permission(inode, mask); + } + + /* +@@ -882,7 +882,7 @@ + sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { + /* TODO: init_user_ns? */ + err = ntfs_xattr_get_acl( +- &init_user_ns, inode, ++ inode, + name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 + ? ACL_TYPE_ACCESS + : ACL_TYPE_DEFAULT, +@@ -903,7 +903,7 @@ + * inode_operations::setxattr + */ + static noinline int ntfs_setxattr(const struct xattr_handler *handler, +- struct user_namespace *mnt_userns, ++ + struct dentry *de, struct inode *inode, + const char *name, const void *value, + size_t size, int flags) +@@ -1013,7 +1013,7 @@ + sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { + /* TODO: init_user_ns? */ + err = ntfs_xattr_set_acl( +- &init_user_ns, inode, ++ inode, + name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 + ? ACL_TYPE_ACCESS + : ACL_TYPE_DEFAULT, diff --git a/kernel-5.14-backport.patch b/kernel-5.14-backport.patch new file mode 100644 index 000000000000..e8d60eb8b92d --- /dev/null +++ b/kernel-5.14-backport.patch @@ -0,0 +1,16 @@ +--- a/file.c ++++ b/file.c +@@ -910,10 +910,10 @@ + size_t cp, tail = PAGE_SIZE - off; + + page = pages[ip]; +- cp = copy_page_from_iter_atomic(page, off, +- min(tail, bytes), from); ++ cp = iov_iter_copy_from_user_atomic(page, from, off, ++ min(tail, bytes)); + flush_dcache_page(page); +- ++ iov_iter_advance(from, cp); + copied += cp; + bytes -= cp; + if (!bytes || !cp) |