From 0e405f98266b48969c2173d032878cc6b2893fcb Mon Sep 17 00:00:00 2001 From: Joe MacDonald Date: Tue, 15 Oct 2013 10:27:27 -0400 Subject: libselinux / libsemanage: work around FD_CLOEXEC and SOCK_CLOEXEC absence [ CQID: WIND00438478 ] [ CQID: WIND00439485 ] Turns out some of the truly old hosts don't even really recognize FD_CLOEXEC and most of the older ones don't know about SOCK_CLOEXEC. Work around each (define FD_CLOEXEC to something sensible, simply don't use SOCK_CLOEXEC, produce warnings in either event). Signed-off-by: Joe MacDonald Signed-off-by: Randy MacLeod Signed-off-by: Jackie Huang Signed-off-by: Mark Hatle --- ...ibsemanage-define-FD_CLOEXEC-as-necessary.patch | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 recipes-security/selinux/libsemanage/libsemanage-define-FD_CLOEXEC-as-necessary.patch (limited to 'recipes-security/selinux/libsemanage/libsemanage-define-FD_CLOEXEC-as-necessary.patch') diff --git a/recipes-security/selinux/libsemanage/libsemanage-define-FD_CLOEXEC-as-necessary.patch b/recipes-security/selinux/libsemanage/libsemanage-define-FD_CLOEXEC-as-necessary.patch new file mode 100644 index 0000000..7be4381 --- /dev/null +++ b/recipes-security/selinux/libsemanage/libsemanage-define-FD_CLOEXEC-as-necessary.patch @@ -0,0 +1,35 @@ +From e783080f30e00d00800ff3491d88c62b2a1c637b Mon Sep 17 00:00:00 2001 +From: Joe MacDonald +Date: Tue, 15 Oct 2013 10:17:38 -0400 +Subject: [PATCH 3/3] libsemanage: define FD_CLOEXEC as necessary + +In truly old systems, even FD_CLOEXEC may not be defined. Produce a +warning and duplicate the #define for FD_CLOEXEC found in +asm-generic/fcntl.h on more modern platforms. + +Uptream-Status: Inappropriate + +Signed-off-by: Joe MacDonald +--- + libsemanage/src/semanage_store.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libsemanage/src/semanage_store.c b/libsemanage/src/semanage_store.c +index 57ef49f..488a14a 100644 +--- a/libsemanage/src/semanage_store.c ++++ b/libsemanage/src/semanage_store.c +@@ -65,6 +65,11 @@ static const char *DISABLESTR="disabled"; + + #define TRUE 1 + ++#ifndef FD_CLOEXEC ++#warning FD_CLOEXEC undefined on this platform, this may leak file descriptors ++#define FD_CLOEXEC 1 ++#endif ++ + enum semanage_file_defs { + SEMANAGE_ROOT, + SEMANAGE_TRANS_LOCK, +-- +1.7.10.4 + -- cgit v1.2.3-54-g00ecf