uid_t and gid_t vs. __kernel_uid_t and __kernel_gid_t
Quoted 3 lines · Vassilii
I had to communicate uid/gid from an application down to a driver, and discovered that uid and gid in user space are different from those in kernel space.
ncpfs uses 'unsigned long' in its ncp_mount_data_v4, as MIPS uses 'long' type for uid/gid. Unfortunately it still needs conversions on some archs, so maybe using u_int64_t is just best solution (AFAIK as MIPS unsigned long is 64bit, you have to use u_int64_t if you want same type accross architectures).
Kernel part then just checks wheter uid == (__kernel_uid_t)uid and gives up if they differ.
Best regards,
Petr Vandrovec [email protected]
Quoted 9 lines · Petr Vandrovec
Quoted 3 lines
I had to communicate uid/gid from an application down to a driver, and discovered that uid and gid in user space are different from those in kernel space.
ncpfs uses 'unsigned long' in its
ncp_mount_data_v4, as MIPS uses 'long' type for uid/gid. Unfortunately it still needs conversions on some archs, so maybe usingu_int64_tis just best solution (AFAIK as MIPS unsigned long is 64bit, you have to useu_int64_tif you want same type accross architectures).
Only for the 64 bit ABI and kernel on MIPS have a long data type of 64 bits. General rule for Linux sizeof(pointer) = sizeof(long).
Quoted 2 lines
Kernel part then just checks wheter uid == (__kernel_uid_t)uid and gives up if they differ.
Otherwise funny ones line (u16) 65536 == 0 -> root access could happen ...
Ralf