* [PATCH v3 1/6] selinux-testsuite: add _GNU_SOURCE to tests/Makefile
2015-06-04 20:57 [PATCH v3 0/6] SELinux testsuite compilation fixes Paul Moore
@ 2015-06-04 20:58 ` Paul Moore
2015-06-04 20:58 ` [PATCH v3 2/6] selinux-testsuite: add some default CFLAGS Paul Moore
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2015-06-04 20:58 UTC (permalink / raw)
To: selinux
As suggested by Stephen Smalley. A couple of msgbuf struct
definitions had to be renamed as they were conflicting with system
definitions.
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/Makefile | 3 +++
tests/msg/msgrcv.c | 9 ++++-----
tests/msg/msgsnd.c | 11 +++++------
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
index e9d4646..8100b8f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,3 +1,6 @@
+
+export CFLAGS+=-D_GNU_SOURCE
+
DISTRO=$(shell ./os_detect)
SUBDIRS_COMMON:=domain_trans entrypoint execshare exectrace execute_no_trans fdreceive inherit link mkdir msg open ptrace readlink relabel rename rxdir sem setattr setnice shm sigkill stat sysctl task_create task_setnice task_setscheduler task_getscheduler task_getsid task_getpgid task_setpgid wait file ioctl capable_file capable_net capable_sys
diff --git a/tests/msg/msgrcv.c b/tests/msg/msgrcv.c
index b23c801..1276c12 100644
--- a/tests/msg/msgrcv.c
+++ b/tests/msg/msgrcv.c
@@ -5,10 +5,9 @@
#include <sys/msg.h>
#define MSGMAX 1024
-
-struct msgbuf {
- long mtype; /* message type, must be > 0 */
- char mtext[1024]; /* message data */
+struct msgbuf_test {
+ long mtype;
+ char mtext[MSGMAX];
};
int main(int argc, char **argv)
@@ -17,7 +16,7 @@ int main(int argc, char **argv)
int key = 0x8888;
int id;
int error;
- struct msgbuf msgp;
+ struct msgbuf_test msgp;
while ((ch = getopt(argc, argv, "k:")) != EOF) {
switch (ch) {
diff --git a/tests/msg/msgsnd.c b/tests/msg/msgsnd.c
index e200aef..57bb027 100644
--- a/tests/msg/msgsnd.c
+++ b/tests/msg/msgsnd.c
@@ -6,10 +6,9 @@
#include <string.h>
#define MSGMAX 1024
-
-struct msgbuf {
- long mtype; /* message type, must be > 0 */
- char mtext[1024]; /* message data */
+struct msgbuf_test {
+ long mtype;
+ char mtext[MSGMAX];
};
int main(int argc, char **argv)
@@ -18,7 +17,7 @@ int main(int argc, char **argv)
int key = 0x8888;
int id;
int error;
- struct msgbuf msgp;
+ struct msgbuf_test msgp;
while ((ch = getopt(argc, argv, "k:")) != EOF) {
switch (ch) {
@@ -32,7 +31,7 @@ int main(int argc, char **argv)
if (id == -1)
return 1;
- memset(&msgp, 'z', sizeof(struct msgbuf));
+ memset(&msgp, 'z', sizeof(msgp));
msgp.mtype = 1;
error = msgsnd(id, &msgp, MSGMAX, IPC_NOWAIT);
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 2/6] selinux-testsuite: add some default CFLAGS
2015-06-04 20:57 [PATCH v3 0/6] SELinux testsuite compilation fixes Paul Moore
2015-06-04 20:58 ` [PATCH v3 1/6] selinux-testsuite: add _GNU_SOURCE to tests/Makefile Paul Moore
@ 2015-06-04 20:58 ` Paul Moore
2015-06-04 20:58 ` [PATCH v3 3/6] selinux-testsuite: fix some compile warnings in tests/nnp Paul Moore
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2015-06-04 20:58 UTC (permalink / raw)
To: selinux
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile b/tests/Makefile
index 8100b8f..b679137 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,5 +1,5 @@
-export CFLAGS+=-D_GNU_SOURCE
+export CFLAGS+=-g -O0 -Wall -D_GNU_SOURCE
DISTRO=$(shell ./os_detect)
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 3/6] selinux-testsuite: fix some compile warnings in tests/nnp
2015-06-04 20:57 [PATCH v3 0/6] SELinux testsuite compilation fixes Paul Moore
2015-06-04 20:58 ` [PATCH v3 1/6] selinux-testsuite: add _GNU_SOURCE to tests/Makefile Paul Moore
2015-06-04 20:58 ` [PATCH v3 2/6] selinux-testsuite: add some default CFLAGS Paul Moore
@ 2015-06-04 20:58 ` Paul Moore
2015-06-04 20:58 ` [PATCH v3 4/6] selinux-testsuite: fix compile warnings in tests/setnice Paul Moore
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2015-06-04 20:58 UTC (permalink / raw)
To: selinux
Correct the following:
make[2]: Entering directory '/root/sources/selinux-testsuite/tests/nnp'
cc execnnp.c -lselinux -o execnnp
execnnp.c: In function 'main':
execnnp.c:27:9: warning: implicit declaration of function 'strverscmp'
(strverscmp(uts.release, "3.18") < 0));
^
execnnp.c:47:8: warning: implicit declaration of function 'wait'
pid = wait(&status);
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/nnp/execnnp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/nnp/execnnp.c b/tests/nnp/execnnp.c
index a5a80cf..756c2d0 100644
--- a/tests/nnp/execnnp.c
+++ b/tests/nnp/execnnp.c
@@ -5,6 +5,8 @@
#include <unistd.h>
#include <sys/utsname.h>
#include <sys/prctl.h>
+#include <sys/types.h>
+#include <sys/wait.h>
int main(int argc, char **argv)
{
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 4/6] selinux-testsuite: fix compile warnings in tests/setnice
2015-06-04 20:57 [PATCH v3 0/6] SELinux testsuite compilation fixes Paul Moore
` (2 preceding siblings ...)
2015-06-04 20:58 ` [PATCH v3 3/6] selinux-testsuite: fix some compile warnings in tests/nnp Paul Moore
@ 2015-06-04 20:58 ` Paul Moore
2015-06-04 20:58 ` [PATCH v3 5/6] selinux-testsuite: fix compile problems in tests/shm Paul Moore
2015-06-04 20:58 ` [PATCH v3 6/6] selinux-testsuite: fix compile problems in tests/capable_file Paul Moore
5 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2015-06-04 20:58 UTC (permalink / raw)
To: selinux
Correct the following:
make[2]: Entering directory '/root/sources/selinux-testsuite/tests/setnice'
cc parent.c -lselinux -o parent
parent.c: In function 'main':
parent.c:92:9: warning: implicit declaration of function 'setpriority'
rc = setpriority(0,pid,10);
^
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/setnice/parent.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/setnice/parent.c b/tests/setnice/parent.c
index d5a2533..6d3c855 100644
--- a/tests/setnice/parent.c
+++ b/tests/setnice/parent.c
@@ -3,6 +3,8 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <signal.h>
#include <selinux/selinux.h>
#include <selinux/context.h>
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 5/6] selinux-testsuite: fix compile problems in tests/shm
2015-06-04 20:57 [PATCH v3 0/6] SELinux testsuite compilation fixes Paul Moore
` (3 preceding siblings ...)
2015-06-04 20:58 ` [PATCH v3 4/6] selinux-testsuite: fix compile warnings in tests/setnice Paul Moore
@ 2015-06-04 20:58 ` Paul Moore
2015-06-04 20:58 ` [PATCH v3 6/6] selinux-testsuite: fix compile problems in tests/capable_file Paul Moore
5 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2015-06-04 20:58 UTC (permalink / raw)
To: selinux
Resolve the following problems:
make[2]: Entering directory '/home/pmoore/sources/selinux-testsuite/selinux_testsuite-upstream/tests/shm'
cc -g -O0 -Wall -D_GNU_SOURCE shmctl.c -o shmctl
shmctl.c: In function 'main':
shmctl.c:11:6: warning: variable 'num' set but not used
int num = 1;
^
cc -g -O0 -Wall -D_GNU_SOURCE shmat.c -o shmat
shmat.c: In function 'main':
shmat.c:11:6: warning: variable 'num' set but not used
int num = 1;
^
cc -g -O0 -Wall -D_GNU_SOURCE shmget.c -o shmget
shmget.c: In function 'main':
shmget.c:11:6: warning: variable 'num' set but not used
int num = 1;
^
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/shm/shmat.c | 6 +-----
tests/shm/shmctl.c | 6 +-----
tests/shm/shmget.c | 6 +-----
3 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/tests/shm/shmat.c b/tests/shm/shmat.c
index 89ac299..704d676 100644
--- a/tests/shm/shmat.c
+++ b/tests/shm/shmat.c
@@ -8,20 +8,16 @@
int main(int argc, char **argv)
{
int ch;
- int num = 1;
int key = 0x8888;
int id;
int error;
char *buf;
- while ((ch = getopt(argc, argv, "k:-n:")) != -1) {
+ while ((ch = getopt(argc, argv, "k:")) != -1) {
switch (ch) {
case 'k':
key = atoi(optarg);
break;
- case 'n':
- num = atoi(optarg);
- break;
}
}
diff --git a/tests/shm/shmctl.c b/tests/shm/shmctl.c
index 78397b6..d17a804 100644
--- a/tests/shm/shmctl.c
+++ b/tests/shm/shmctl.c
@@ -8,20 +8,16 @@
int main(int argc, char **argv)
{
int ch;
- int num = 1;
int key = 0x8888;
int id;
int error;
struct shmid_ds buf;
- while ((ch = getopt(argc, argv, "k:-n:")) != -1) {
+ while ((ch = getopt(argc, argv, "k:")) != -1) {
switch (ch) {
case 'k':
key = atoi(optarg);
break;
- case 'n':
- num = atoi(optarg);
- break;
}
}
diff --git a/tests/shm/shmget.c b/tests/shm/shmget.c
index a04da25..42d6394 100644
--- a/tests/shm/shmget.c
+++ b/tests/shm/shmget.c
@@ -8,18 +8,14 @@
int main(int argc, char **argv)
{
int ch;
- int num = 1;
int key = 0x8888;
int id;
- while ((ch = getopt(argc, argv, "k:-n:")) != -1) {
+ while ((ch = getopt(argc, argv, "k:")) != -1) {
switch (ch) {
case 'k':
key = atoi(optarg);
break;
- case 'n':
- num = atoi(optarg);
- break;
}
}
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3 6/6] selinux-testsuite: fix compile problems in tests/capable_file
2015-06-04 20:57 [PATCH v3 0/6] SELinux testsuite compilation fixes Paul Moore
` (4 preceding siblings ...)
2015-06-04 20:58 ` [PATCH v3 5/6] selinux-testsuite: fix compile problems in tests/shm Paul Moore
@ 2015-06-04 20:58 ` Paul Moore
2015-06-05 13:20 ` Stephen Smalley
5 siblings, 1 reply; 9+ messages in thread
From: Paul Moore @ 2015-06-04 20:58 UTC (permalink / raw)
To: selinux
Fix the following warnings:
make[2]: Entering directory '/home/pmoore/sources/selinux-testsuite/selinux_testsuite-upstream/tests/capable_file'
cc -g -O0 -Wall -D_GNU_SOURCE test_lease.c -o test_lease
test_lease.c: In function 'main':
test_lease.c:22:3: warning: implicit declaration of function 'open'
fd = open(argv[1], O_RDONLY, 0);
^
test_lease.c:29:3: warning: implicit declaration of function 'fcntl'
rc = fcntl(fd, F_SETLEASE, 0);
^
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/capable_file/test_lease.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tests/capable_file/test_lease.c b/tests/capable_file/test_lease.c
index 606d75c..e8f29eb 100644
--- a/tests/capable_file/test_lease.c
+++ b/tests/capable_file/test_lease.c
@@ -1,9 +1,10 @@
-#include<stdio.h>
-#include<stdlib.h>
-#include<sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <linux/posix_types.h>
-#include<linux/fcntl.h>
#include <unistd.h>
+#include <fcntl.h>
/*
* Test the fcntl F_SETLEASE operation on a file whose name is given as
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v3 6/6] selinux-testsuite: fix compile problems in tests/capable_file
2015-06-04 20:58 ` [PATCH v3 6/6] selinux-testsuite: fix compile problems in tests/capable_file Paul Moore
@ 2015-06-05 13:20 ` Stephen Smalley
2015-06-05 13:50 ` Paul Moore
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Smalley @ 2015-06-05 13:20 UTC (permalink / raw)
To: Paul Moore, selinux
On 06/04/2015 04:58 PM, Paul Moore wrote:
> Fix the following warnings:
>
> make[2]: Entering directory '/home/pmoore/sources/selinux-testsuite/selinux_testsuite-upstream/tests/capable_file'
> cc -g -O0 -Wall -D_GNU_SOURCE test_lease.c -o test_lease
> test_lease.c: In function 'main':
> test_lease.c:22:3: warning: implicit declaration of function 'open'
> fd = open(argv[1], O_RDONLY, 0);
> ^
> test_lease.c:29:3: warning: implicit declaration of function 'fcntl'
> rc = fcntl(fd, F_SETLEASE, 0);
> ^
>
> Signed-off-by: Paul Moore <paul@paul-moore.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
for all 6 patches.
> ---
> tests/capable_file/test_lease.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/tests/capable_file/test_lease.c b/tests/capable_file/test_lease.c
> index 606d75c..e8f29eb 100644
> --- a/tests/capable_file/test_lease.c
> +++ b/tests/capable_file/test_lease.c
> @@ -1,9 +1,10 @@
> -#include<stdio.h>
> -#include<stdlib.h>
> -#include<sys/types.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> #include <linux/posix_types.h>
> -#include<linux/fcntl.h>
> #include <unistd.h>
> +#include <fcntl.h>
>
> /*
> * Test the fcntl F_SETLEASE operation on a file whose name is given as
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 6/6] selinux-testsuite: fix compile problems in tests/capable_file
2015-06-05 13:20 ` Stephen Smalley
@ 2015-06-05 13:50 ` Paul Moore
0 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2015-06-05 13:50 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux
On Friday, June 05, 2015 09:20:11 AM Stephen Smalley wrote:
> On 06/04/2015 04:58 PM, Paul Moore wrote:
> > Fix the following warnings:
> >
> > make[2]: Entering directory
> > '/home/pmoore/sources/selinux-testsuite/selinux_testsuite-upstream/tests/
> > capable_file' cc -g -O0 -Wall -D_GNU_SOURCE test_lease.c -o
> > test_lease
> > test_lease.c: In function 'main':
> > test_lease.c:22:3: warning: implicit declaration of function 'open'
> >
> > fd = open(argv[1], O_RDONLY, 0);
> > ^
> >
> > test_lease.c:29:3: warning: implicit declaration of function 'fcntl'
> >
> > rc = fcntl(fd, F_SETLEASE, 0);
> > ^
> >
> > Signed-off-by: Paul Moore <paul@paul-moore.com>
>
> Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
> for all 6 patches.
Thanks. I went ahead and applied the patches last night along with the astyle
patch.
--
paul moore
security @ redhat
^ permalink raw reply [flat|nested] 9+ messages in thread