Skip to contentSkip to conversation

SELinux Compilation Error on Redhat 8.0 with LSM 2.5

DISCUSSION Rakesh Tripathi 2 participants 2 messages May 2, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,
I'm trying to install SELinux on RedHat 8.0 and I get the following compliation .Any help appreciated.

Thanks
Rakesh

Output of the compilation

cd ../lsm-2.5 && make dep && make && make modules
make[1]: Entering directory `/root/lsm-2.5'
*** Warning: make dep is unnecessary now.
make[1]: Leaving directory `/root/lsm-2.5'
make[1]: Entering directory `/root/lsm-2.5'
make -f scripts/Makefile.build obj=scripts
make -f scripts/Makefile.build obj=scripts/genksyms
gcc -Wp,-MD,scripts/.empty.o.d -D__KERNEL__ -Iinclude -Wall
-Wstrict-prototype
s -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-bo undary=2 -march=i686 -Iinclude/asm-i386/mach-default -fomit-frame-pointer -nostd
inc -iwithprefix include -DKBUILD_BASENAME=empty -DKBUILD_MODNAME=empty -c -o
scripts/.tmp_empty.o scripts/empty.c
scripts/mk_elfconfig i386 < scripts/empty.o > scripts/elfconfig.h gcc -Wp,-MD,scripts/.file2alias.o.d -Wall -Wstrict-prototypes -O2
-fomit-frame
-pointer -c -o scripts/file2alias.o scripts/file2alias.c
gcc -Wp,-MD,scripts/.modpost.o.d -Wall -Wstrict-prototypes -O2
-fomit-frame-po
inter -c -o scripts/modpost.o scripts/modpost.c
gcc -o scripts/modpost scripts/modpost.o scripts/file2alias.o
SPLIT include/linux/autoconf.h -> include/config/*
rm -rf .tmp_versions
mkdir -p .tmp_versions
Starting the build. KBUILD_BUILTIN=1 KBUILD_MODULES=1
make -f scripts/Makefile.build obj=init
CHK include/linux/compile.h
make -f scripts/Makefile.build obj=usr
make -f scripts/Makefile.build obj=arch/i386/kernel
make -f scripts/Makefile.build obj=arch/i386/kernel/cpu
make -f scripts/Makefile.build obj=arch/i386/kernel/cpu/cpufreq make -f scripts/Makefile.build obj=arch/i386/kernel/cpu/mcheck
make -f scripts/Makefile.build obj=arch/i386/kernel/cpu/mtrr
make -f scripts/Makefile.build obj=arch/i386/kernel/timers
make -f scripts/Makefile.build obj=arch/i386/mm
make -f scripts/Makefile.build obj=arch/i386/mach-default
make -f scripts/Makefile.build obj=kernel
make -f scripts/Makefile.build obj=mm
make -f scripts/Makefile.build obj=fs
make -f scripts/Makefile.build obj=fs/afs
make -f scripts/Makefile.build obj=fs/autofs
make -f scripts/Makefile.build obj=fs/autofs4
make -f scripts/Makefile.build obj=fs/befs
make -f scripts/Makefile.build obj=fs/bfs
make -f scripts/Makefile.build obj=fs/coda
make -f scripts/Makefile.build obj=fs/cramfs
gcc -Wp,-MD,fs/cramfs/.inode.o.d -D__KERNEL__ -Iinclude -Wall
-Wstrict-prototy
pes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack- boundary=2 -march=i686 -Iinclude/asm-i386/mach-default -fomit-frame-pointer -nos
tdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=inode -DKBUILD_MODNAME=c
ramfs -c -o fs/cramfs/.tmp_inode.o fs/cramfs/inode.c fs/cramfs/inode.c: In function `get_cramfs_inode':
fs/cramfs/inode.c:54: incompatible types in assignment
make[3]: *** [fs/cramfs/inode.o] Error 1
make[2]: *** [fs/cramfs] Error 2
make[1]: *** [fs] Error 2
make[1]: Leaving directory `/root/lsm-2.5'
make: *** [quickinstall] Error 2

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 3 lines · Rakesh Tripathi

Hi all,
I'm trying to install SELinux on RedHat 8.0 and I get the following
compliation .Any help appreciated.

<snip>

Quoted 2 lines

fs/cramfs/inode.c: In function `get_cramfs_inode':
fs/cramfs/inode.c:54: incompatible types in assignment

The first attached patch should fix this problem. Save it to ~/cramfs.patch, cd lsm-2.5, and run 'patch -p1 < ~/cramfs.patch'. As a side note, the lsm-2.5 tree will be obsoleted by the mainline 2.5-based SELinux; see http://www.nsa.gov/selinux/lk for a current snapshot of it. However, the mainline 2.5-based SELinux doesn't yet have a full userland environment.

I expect that you may also run into a problem with building libsecure due to the change in the stat structure definition. The second attached patch may help with that problem. To use it, save it to ~/newstat.patch, cd selinux, and run 'patch -p1 < ~/newstat.patch'. This also will be obsoleted by the mainline 2.5-based SELinux, as we no longer provide an extended stat call.

Signature · 2 lines
Stephen Smalley <[email protected]>
National Security Agency
fs/cramfs/inode.c +3 -1
@@ -43,6 +43,7 @@
 static struct inode *get_cramfs_inode(struct super_block *sb, struct cramfs_inode * cramfs_inode)
 {
 	struct inode * inode = new_inode(sb);
+	static struct timespec zerotime = { 0, 0 };
 
 	if (inode) {
 		inode->i_mode = cramfs_inode->mode;
@@ -51,7 +52,8 @@
 		inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
 		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_gid = cramfs_inode->gid;
-		inode->i_mtime = inode->i_atime = inode->i_ctime = 0;
+		/* Struct copy intentional */
+		inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime;
 		inode->i_ino = CRAMINO(cramfs_inode);
 		/* inode->i_nlink is left 1 - arguably wrong for directories,
 		   but it's the best we can do without reading the directory

Index: selinux/libsecure/src/kernel_stat.h
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/kernel_stat.h,v retrieving revision 1.2

libsecure/src/kernel_stat.h +12 -9
diff -u -r1.2 kernel_stat.h
@@ -15,18 +15,21 @@
     unsigned long int st_size;
     unsigned long int st_blksize;
     unsigned long int st_blocks;
-    unsigned long int st_atime;
-    unsigned long int __unused1;
-#define _HAVE___UNUSED1
-    unsigned long int st_mtime;
-    unsigned long int __unused2;
-#define _HAVE___UNUSED2
-    unsigned long int st_ctime;
-    unsigned long int __unused3;
-#define _HAVE___UNUSED3
+    struct timespec st_atim;
+    struct timespec st_mtim;
+    struct timespec st_ctim;
     unsigned long int __unused4;
 #define _HAVE___UNUSED4
     unsigned long int __unused5;
 #define _HAVE___UNUSED5
   };
 
+#define _HAVE_STAT___UNUSED4
+#define _HAVE_STAT___UNUSED5
+#define _HAVE_STAT___PAD1
+#define _HAVE_STAT___PAD2
+#define _HAVE_STAT_NSEC
+#define _HAVE_STAT64___PAD1
+#define _HAVE_STAT64___PAD2
+#define _HAVE_STAT64___ST_INO
+#define _HAVE_STAT64_NSEC

Index: selinux/libsecure/src/xstat_conv.h
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/xstat_conv.h,v retrieving revision 1.1.1.1

libsecure/src/xstat_conv.h +33 -19

96 lines not on this page · raw message

Index: selinux/libsecure/src/arch/i386/fstat64_secure.c
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/arch/i386/fstat64_secure.c,v retrieving revision 1.2

libsecure/src/arch/i386/fstat64_secure.c +2 -9
diff -u -r1.2 fstat64_secure.c
@@ -2,26 +2,19 @@
 #include <fs_secure.h>
 #include <security.h>
 #include <errno.h>
-#include "kernel_stat64.h"
-#include "xstat64_conv.h"
 #include <flask_util.h>
 
 int fstat64_secure(unsigned int fd,
 		   struct stat64 *buf, 
 		   security_id_t *out_sid)
 {
-	struct kernel_stat64 kbuf;
 	unsigned long args[3];
-	long err;
 
 	if (is_flask_enabled()) {	
 		args[0] = (unsigned long)fd;
-		args[1] = (unsigned long)&kbuf;
+		args[1] = (unsigned long)buf;
 		args[2] = (unsigned long)out_sid;
-		err = security(SELINUX_MAGIC, SELINUXCALL_FSTAT64, args);
-		if (err)
-			return err;
-		return xstat64_conv(_STAT_VER_LINUX, &kbuf, buf);
+		return security(SELINUX_MAGIC, SELINUXCALL_FSTAT64, args);
 	} else {
 		/* Compatibility for the modified utilities
 		   until they are fixed. */

Index: selinux/libsecure/src/arch/i386/lstat64_secure.c
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/arch/i386/lstat64_secure.c,v retrieving revision 1.2

libsecure/src/arch/i386/lstat64_secure.c +2 -9
diff -u -r1.2 lstat64_secure.c
@@ -2,26 +2,19 @@
 #include <fs_secure.h>
 #include <security.h>
 #include <errno.h>
-#include "kernel_stat64.h"
-#include "xstat64_conv.h"
 #include <flask_util.h>
 
 int lstat64_secure(const char *pathname, 
 		   struct stat64 *buf, 
 		   security_id_t *out_sid)
 {
-	struct kernel_stat64 kbuf;
 	unsigned long args[3];
-	int err;
 	
 	if (is_flask_enabled()) {
 		args[0] = (unsigned long)pathname;
-		args[1] = (unsigned long)&kbuf;
+		args[1] = (unsigned long)buf;
 		args[2] = (unsigned long)out_sid;
-		err = security(SELINUX_MAGIC, SELINUXCALL_LSTAT64, args);
-		if (err)
-			return err; 
-		return xstat64_conv(_STAT_VER_LINUX, &kbuf, buf);
+		return security(SELINUX_MAGIC, SELINUXCALL_LSTAT64, args);
 	} else {
 		/* Compatibility for the modified utilities
 		   until they are fixed. */

Index: selinux/libsecure/src/arch/i386/stat64_secure.c
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/arch/i386/stat64_secure.c,v retrieving revision 1.2

libsecure/src/arch/i386/stat64_secure.c +2 -9
diff -u -r1.2 stat64_secure.c
@@ -2,26 +2,19 @@
 #include <fs_secure.h>
 #include <security.h>
 #include <errno.h>
-#include "kernel_stat64.h"
-#include "xstat64_conv.h"
 #include <flask_util.h>
 
 int stat64_secure(const char *pathname, 
 		  struct stat64 *buf, 
 		  security_id_t *out_sid)
 {
-	struct kernel_stat64 kbuf;
 	unsigned long args[3];
-	long err;
 
 	if (is_flask_enabled()) {
 		args[0] = (unsigned long)pathname;
-		args[1] = (unsigned long)&kbuf;
+		args[1] = (unsigned long)buf;
 		args[2] = (unsigned long)out_sid;
-		err = security(SELINUX_MAGIC, SELINUXCALL_STAT64, args);
-		if (err)
-			return err;
-		return xstat64_conv(_STAT_VER_LINUX, &kbuf, buf);
+		return security(SELINUX_MAGIC, SELINUXCALL_STAT64, args);
 	} else {
 		/* Compatibility for the modified utilities
 		   until they are fixed. */