Problems compiling libsecure
To any helpful soul:
I am trying to compile and install the latest SE linux (2003071106) from the
lsm-2.4-selinux-2003071106.tgz package. I am following the step by step instructions rather than the quick install, and everything is proceeding fine until I attempt to compile libsecure whereupon I get(pardon my linewrap):
cc -o fstat_secure.o -c -I../include -I/usr/local/selinux/include\fstat_secure.c
In file included from fstat_secure.c:5:xstat_conv.h: In function `xstat_conv':
xstat_conv.h:59: structure has no member named st_atim' xstat_conv.h:60: structure has no member named st_atim' xstat_conv.h:61: structure has no member named st_mtim' xstat_conv.h:62: structure has no member named st_mtim' xstat_conv.h:63: structure has no member named st_ctim' xstat_conv.h:64: structure has no member named st_ctim' make[1]: *** [fstat_secure.o] Error 1
Now I don't profess to be a C programmer (or even close!) but I think that bit of code is calling for the kernel's stat structure? I tried copying the lsm-2.4 /include/asm/stat* to the libsecure/include but no help there...I also tried commenting out various includes from kernel_stat.h but no help there either.
Other possibly helpful info: compiling on 2.4.7 kernel w/ gcc 2.96 20000731 (old RedHat 7.1 laptop). Any thoughts? TIA...
D
Signature · 13 lines
Don Mills SCSA SCNA CCNP CCDP CISSP CQS-VPN Network Security/WAN Architect VA Dept. of Social Services [email protected] -- 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.
Quoted 18 lines · Don Mills
To any helpful soul:
I am trying to compile and install the latest SE linux (2003071106) from the
lsm-2.4-selinux-2003071106.tgz package. I am following the step by step instructions rather than the quick install, and everything is proceeding fine until I attempt to compile libsecure whereupon I get(pardon my linewrap):cc -o fstat_secure.o -c -I../include -I/usr/local/selinux/include\
fstat_secure.c
In file included from fstat_secure.c:5:xstat_conv.h: In function `xstat_conv':
xstat_conv.h:59: structure has no member namedst_atim' xstat_conv.h:60: structure has no member namedst_atim' xstat_conv.h:61: structure has no member namedst_mtim' xstat_conv.h:62: structure has no member namedst_mtim' xstat_conv.h:63: structure has no member namedst_ctim' xstat_conv.h:64: structure has no member namedst_ctim' make[1]: *** [fstat_secure.o] Error 1
Quoted 7 lines
Now I don't profess to be a C programmer (or even close!) but I think that bit of code is calling for the kernel's stat structure? I tried copying the lsm-2.4 /include/asm/stat* to the libsecure/include but no help there...I also tried commenting out various includes from
kernel_stat.hbut no help there either.
Other possibly helpful info: compiling on 2.4.7 kernel w/ gcc 2.96 20000731 (old RedHat 7.1 laptop). Any thoughts?
The stat structure definition changed in more recent glibc's. To make it work with your older glibc, save the attached patch to ~/oldstat.patch, cd selinux/libsecure, and run 'patch -p1 < ~/oldstat.patch'. Then try building it again.
This issue (and libsecure) will be obsoleted by the back port of the 2.5/6 SELinux API changes and xattr support to the 2.4-based SELinux, coming soon. At that point, the same userland and policy should be useable for both versions of SELinux.
Signature · 2 lines
Stephen Smalley <[email protected]> National Security Agency
Index: libsecure/src/kernel_stat.h
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/kernel_stat.h,v retrieving revision 1.3
src/kernel_stat.h +9 -12
@@ -15,21 +15,18 @@unsigned long int st_size;unsigned long int st_blksize;unsigned long int st_blocks; -struct timespec st_atim; -struct timespec st_mtim; -struct timespec st_ctim; +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___UNUSED3unsigned long int __unused4;#define _HAVE___UNUSED4unsigned 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: libsecure/src/xstat_conv.h
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/xstat_conv.h,v retrieving revision 1.2
src/xstat_conv.h +19 -33
96 lines not on this page · raw message
Index: libsecure/src/arch/i386/fstat64_secure.c
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/arch/i386/fstat64_secure.c,v retrieving revision 1.3
src/arch/i386/fstat64_secure.c +9 -2
@@ -2,19 +2,26 @@#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 )buf; + args[1 ] = (unsigned long )&kbuf; args[2 ] = (unsigned long )out_sid; -return security (SELINUX_MAGIC ,SELINUXCALL_FSTAT64 , args); + err =security (SELINUX_MAGIC ,SELINUXCALL_FSTAT64 , args); +if (err) +return err; +return xstat64_conv (_STAT_VER_LINUX, &kbuf, buf); }else {/* Compatibility for the modified utilities until they are fixed. */
Index: libsecure/src/arch/i386/lstat64_secure.c
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/arch/i386/lstat64_secure.c,v retrieving revision 1.3
src/arch/i386/lstat64_secure.c +9 -2
@@ -2,19 +2,26 @@#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 )buf; + args[1 ] = (unsigned long )&kbuf; args[2 ] = (unsigned long )out_sid; -return security (SELINUX_MAGIC ,SELINUXCALL_LSTAT64 , args); + err =security (SELINUX_MAGIC ,SELINUXCALL_LSTAT64 , args); +if (err) +return err; +return xstat64_conv (_STAT_VER_LINUX, &kbuf, buf); }else {/* Compatibility for the modified utilities until they are fixed. */
Index: libsecure/src/arch/i386/stat64_secure.c
===================================================================
RCS file: /home/pal/CVS/selinux/libsecure/src/arch/i386/stat64_secure.c,v retrieving revision 1.3
src/arch/i386/stat64_secure.c +9 -2
@@ -2,19 +2,26 @@#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 )buf; + args[1 ] = (unsigned long )&kbuf; args[2 ] = (unsigned long )out_sid; -return security (SELINUX_MAGIC ,SELINUXCALL_STAT64 , args); + err =security (SELINUX_MAGIC ,SELINUXCALL_STAT64 , args); +if (err) +return err; +return xstat64_conv (_STAT_VER_LINUX, &kbuf, buf); }else {/* Compatibility for the modified utilities until they are fixed. */
Stephen,
Yep that fixed it. Much thanks.
D
Quoted 37 lines · Stephen Smalley
Quoted 19 lines · Don Mills
To any helpful soul:
I am trying to compile and install the latest SE linux (2003071106) from
the lsm-2.4-selinux-2003071106.tgz package. I am following the step by step instructions rather than the quick install, and everything is proceeding fine until I attempt to compile libsecure whereupon I get(pardon my linewrap):cc -o fstat_secure.o -c -I../include -I/usr/local/selinux/include\
fstat_secure.c
In file included from fstat_secure.c:5:xstat_conv.h: In function `xstat_conv':
xstat_conv.h:59: structure has no member namedst_atim' xstat_conv.h:60: structure has no member namedst_atim' xstat_conv.h:61: structure has no member namedst_mtim' xstat_conv.h:62: structure has no member namedst_mtim' xstat_conv.h:63: structure has no member namedst_ctim' xstat_conv.h:64: structure has no member namedst_ctim' make[1]: *** [fstat_secure.o] Error 1Quoted 7 lines
Now I don't profess to be a C programmer (or even close!) but I think that bit of code is calling for the kernel's stat structure? I tried copying the lsm-2.4 /include/asm/stat* to the libsecure/include but no help there...I also tried commenting out various includes from
kernel_stat.hbut no help there either.
Other possibly helpful info: compiling on 2.4.7 kernel w/ gcc 2.96 20000731 (old RedHat 7.1 laptop). Any thoughts?The stat structure definition changed in more recent glibc's. To make it work with your older glibc, save the attached patch to
~/oldstat.patch, cd selinux/libsecure, and run 'patch -p1 <~/oldstat.patch'. Then try building it again.This issue (and libsecure) will be obsoleted by the back port of the 2.5/6 SELinux API changes and xattr support to the 2.4-based SELinux, coming soon. At that point, the same userland and policy should be useable for both versions of SELinux.
Signature · 13 lines
Don Mills SCSA SCNA CCNP CCDP CISSP CQS-VPN Network Security/WAN Architect VA Dept. of Social Services [email protected] -- 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.