cifsd-team / ksmbd

ksmbd kernel server(SMB/CIFS server)
151 stars 23 forks source link

Compile error on Oracle kernel-uek R7 #585

Open Lathanderjk opened 1 year ago

Lathanderjk commented 1 year ago

There is no problem compiling for Oracle kernel-uek R6 (based on upstream 5.4) but on R7 ( 5.15, gcc 11) it`s throwing error

scl enable gcc-toolset-11 "make"
make -C /lib/modules/5.15.0-5.76.5.1.el8uek.x86_64/build M=/root/ksmbd modules
make[1]: Entering directory '/usr/src/kernels/5.15.0-5.76.5.1.el8uek.x86_64'
  CC [M]  /root/ksmbd/unicode.o
In file included from /root/ksmbd/vfs.h:17,
                 from /root/ksmbd/vfs_cache.h:16,
                 from /root/ksmbd/glob.h:13,
                 from /root/ksmbd/unicode.c:12:
/root/ksmbd/smbacl.h: In function ‘posix_acl_uid_translate’:
/root/ksmbd/smbacl.h:236:16: error: implicit declaration of function ‘kuid_into_mnt’; did you mean ‘i_uid_into_mnt’? [-Werror=implicit-function-declaration]
  236 |         kuid = kuid_into_mnt(mnt_userns, pace->e_uid);
      |                ^~~~~~~~~~~~~
      |                i_uid_into_mnt
/root/ksmbd/smbacl.h:236:16: error: incompatible types when assigning to type ‘kuid_t’ from type ‘int’
/root/ksmbd/smbacl.h: In function ‘posix_acl_gid_translate’:
/root/ksmbd/smbacl.h:269:16: error: implicit declaration of function ‘kgid_into_mnt’; did you mean ‘i_gid_into_mnt’? [-Werror=implicit-function-declaration]
  269 |         kgid = kgid_into_mnt(mnt_userns, pace->e_gid);
      |                ^~~~~~~~~~~~~
      |                i_gid_into_mnt
/root/ksmbd/smbacl.h:269:16: error: incompatible types when assigning to type ‘kgid_t’ from type ‘int’
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:288: /root/ksmbd/unicode.o] Error 1
make[1]: *** [Makefile:1976: /root/ksmbd] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.15.0-5.76.5.1.el8uek.x86_64'
make: *** [Makefile:47: all] Error 2
namjaejeon commented 1 year ago

What is this kernel version("5.15.0-5.76.5.1.el8uek.x86_64") ? This seems custom kernel. We support only mainline kernel version.

neheb commented 1 year ago

RHEL based kernel.

namjaejeon commented 1 year ago

Okay, But ksmbd is using KERNEL_VERSION macro to distinguish each kernel versions. When I see "5.15.0-5.76.5.1.el8uek.x86_64" name, he doesn't update PATCHLEVEL and SUBLEVEL in Makefile of kernel.

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || \
    (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 52) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
        vfsuid = make_vfsuid(mnt_userns, &init_user_ns, pace->e_uid);
#else
        kuid = mapped_kuid_fs(mnt_userns, &init_user_ns, pace->e_uid);
#endif
#else
        kuid = kuid_into_mnt(mnt_userns, pace->e_uid);
#endif  

See Makefile in mainline kernel. They should check them in Makefile of their kernel.

# SPDX-License-Identifier: GPL-2.0
VERSION = 5
PATCHLEVEL = 15
SUBLEVEL = 47
EXTRAVERSION =
NAME = Trick or Treat
neheb commented 1 year ago

Maybe @zx2c4 can help. These enterprise kernel are "special"

Lathanderjk commented 10 months ago

Problem persist and looks like there is same problem on default RHEL9 kernel 5.14.0-284.25.1.0.1.el9_2.x86_64

Even on kernel 6.4.9-1.el8.elrepo.x86_64 from elrepo build fails, incompatible with recent kernels?

In file included from /root/ksmbd/vfs.h:17, from /root/ksmbd/vfs_cache.h:16, from /root/ksmbd/glob.h:13, from /root/ksmbd/unicode.c:12: /root/ksmbd/smbacl.h: In function ‘posix_acl_uid_translate’: /root/ksmbd/smbacl.h:231:23: error: passing argument 1 of ‘make_vfsuid’ from incompatible pointer type [-Werror=incompatible-pointer-types] vfsuid = make_vfsuid(mnt_userns, &init_user_ns, pace->e_uid); ^~~~~~ In file included from ./include/linux/fs.h:44, from /root/ksmbd/unicode.c:9: ./include/linux/mnt_idmapping.h:118:40: note: expected ‘struct mnt_idmap ’ but argument is of type ‘struct user_namespace ’ vfsuid_t make_vfsuid(struct mnt_idmap *idmap,


In file included from /root/ksmbd/vfs.h:17,
                 from /root/ksmbd/vfs_cache.h:16,
                 from /root/ksmbd/glob.h:13,
                 from /root/ksmbd/unicode.c:12:
/root/ksmbd/smbacl.h: In function ‘posix_acl_gid_translate’:
/root/ksmbd/smbacl.h:264:23: error: passing argument 1 of ‘make_vfsgid’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  vfsgid = make_vfsgid(mnt_userns, &init_user_ns, pace->e_gid);
                       ^~~~~~~~~~
In file included from ./include/linux/fs.h:44,
                 from /root/ksmbd/unicode.c:9:
./include/linux/mnt_idmapping.h:121:40: note: expected ‘struct mnt_idmap *’ but argument is of type ‘struct user_namespace *’
 vfsgid_t make_vfsgid(struct mnt_idmap *idmap,
                      ~~~~~~~~~~~~~~~~~~^~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:252: /root/ksmbd/unicode.o] Error 1
make[1]: *** [Makefile:2032: /root/ksmbd] Error 2
make[1]: Leaving directory '/usr/src/kernels/6.4.9-1.el8.elrepo.x86_64'`

Kernel uek R6 and also kernel-lt(5.4.252-1.el8.elrepo.x86_64)  works fine.
neheb commented 1 month ago

Still an issue?