From e0ab958383b672458306dcf9bf0bf589f1454c62 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 2 May 2006 18:23:25 +0000 Subject: [PATCH] - Add selinuxswig fixes - Stop using PAGE_SIZE and start using sysconfig(_SC_PAGE_SIZE) --- libselinux-rhat.patch | 193 ++++++++++++++++++++++++++++++++++++++++++ libselinux.spec | 1 + 2 files changed, 194 insertions(+) diff --git a/libselinux-rhat.patch b/libselinux-rhat.patch index 2c183ab..279fd9b 100644 --- a/libselinux-rhat.patch +++ b/libselinux-rhat.patch @@ -1,3 +1,196 @@ +diff --exclude-from=exclude -N -u -r nsalibselinux/src/canonicalize_context.c libselinux-1.30.3/src/canonicalize_context.c +--- nsalibselinux/src/canonicalize_context.c 2005-11-08 09:34:17.000000000 -0500 ++++ libselinux-1.30.3/src/canonicalize_context.c 2006-05-02 14:11:27.000000000 -0400 +@@ -23,7 +23,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_av.c libselinux-1.30.3/src/compute_av.c +--- nsalibselinux/src/compute_av.c 2005-08-23 13:34:34.000000000 -0400 ++++ libselinux-1.30.3/src/compute_av.c 2006-05-02 14:11:33.000000000 -0400 +@@ -26,7 +26,7 @@ + if (fd < 0) + return -1; + +- len = PAGE_SIZE; ++ len = selinux_page_size; + buf = malloc(len); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_create.c libselinux-1.30.3/src/compute_create.c +--- nsalibselinux/src/compute_create.c 2005-08-23 13:34:34.000000000 -0400 ++++ libselinux-1.30.3/src/compute_create.c 2006-05-02 14:11:39.000000000 -0400 +@@ -25,7 +25,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_member.c libselinux-1.30.3/src/compute_member.c +--- nsalibselinux/src/compute_member.c 2005-08-25 11:32:02.000000000 -0400 ++++ libselinux-1.30.3/src/compute_member.c 2006-05-02 14:11:55.000000000 -0400 +@@ -25,7 +25,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_relabel.c libselinux-1.30.3/src/compute_relabel.c +--- nsalibselinux/src/compute_relabel.c 2005-08-25 11:32:02.000000000 -0400 ++++ libselinux-1.30.3/src/compute_relabel.c 2006-05-02 14:12:05.000000000 -0400 +@@ -25,7 +25,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_user.c libselinux-1.30.3/src/compute_user.c +--- nsalibselinux/src/compute_user.c 2005-08-23 13:34:34.000000000 -0400 ++++ libselinux-1.30.3/src/compute_user.c 2006-05-02 14:13:15.000000000 -0400 +@@ -26,7 +26,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/enabled.c libselinux-1.30.3/src/enabled.c +--- nsalibselinux/src/enabled.c 2005-08-23 13:34:34.000000000 -0400 ++++ libselinux-1.30.3/src/enabled.c 2006-05-02 14:13:20.000000000 -0400 +@@ -22,7 +22,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + enabled = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/getcon.c libselinux-1.30.3/src/getcon.c +--- nsalibselinux/src/getcon.c 2005-08-23 13:34:34.000000000 -0400 ++++ libselinux-1.30.3/src/getcon.c 2006-05-02 14:13:24.000000000 -0400 +@@ -18,7 +18,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/getexeccon.c libselinux-1.30.3/src/getexeccon.c +--- nsalibselinux/src/getexeccon.c 2005-08-25 11:32:02.000000000 -0400 ++++ libselinux-1.30.3/src/getexeccon.c 2006-05-02 14:13:34.000000000 -0400 +@@ -18,7 +18,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/getfscreatecon.c libselinux-1.30.3/src/getfscreatecon.c +--- nsalibselinux/src/getfscreatecon.c 2005-08-25 11:32:02.000000000 -0400 ++++ libselinux-1.30.3/src/getfscreatecon.c 2006-05-02 14:13:39.000000000 -0400 +@@ -18,7 +18,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/getpidcon.c libselinux-1.30.3/src/getpidcon.c +--- nsalibselinux/src/getpidcon.c 2005-08-25 11:32:02.000000000 -0400 ++++ libselinux-1.30.3/src/getpidcon.c 2006-05-02 14:13:46.000000000 -0400 +@@ -22,7 +22,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/getprevcon.c libselinux-1.30.3/src/getprevcon.c +--- nsalibselinux/src/getprevcon.c 2005-08-23 13:34:34.000000000 -0400 ++++ libselinux-1.30.3/src/getprevcon.c 2006-05-02 14:13:51.000000000 -0400 +@@ -18,7 +18,7 @@ + if (fd < 0) + return -1; + +- size = PAGE_SIZE; ++ size = selinux_page_size; + buf = malloc(size); + if (!buf) { + ret = -1; +diff --exclude-from=exclude -N -u -r nsalibselinux/src/init.c libselinux-1.30.3/src/init.c +--- nsalibselinux/src/init.c 2005-12-14 14:16:46.000000000 -0500 ++++ libselinux-1.30.3/src/init.c 2006-05-02 14:18:48.000000000 -0400 +@@ -7,12 +7,14 @@ + #include + #include + #include ++#include + + #include "dso.h" + #include "policy.h" + #include "selinux_internal.h" + + char *selinux_mnt = NULL; ++int selinux_page_size=0; + + static void init_selinuxmnt(void) + { +@@ -27,11 +29,12 @@ + if (!fp) + return; + +- size = PAGE_SIZE; ++ size = selinux_page_size; ++ + buf = malloc(size); + if (!buf) + goto out; +- ++ + memset(buf, 0, size); + + while(( bufp = fgets_unlocked(buf, size, fp))) +@@ -134,6 +137,7 @@ + static void init_lib(void) __attribute__ ((constructor)); + static void init_lib(void) + { ++ selinux_page_size = sysconf(_SC_PAGE_SIZE); + init_selinuxmnt(); + init_translations(); + } +diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux_internal.h libselinux-1.30.3/src/selinux_internal.h +--- nsalibselinux/src/selinux_internal.h 2005-12-01 10:10:32.000000000 -0500 ++++ libselinux-1.30.3/src/selinux_internal.h 2006-05-02 14:11:05.000000000 -0400 +@@ -71,3 +71,4 @@ + + extern int load_setlocaldefs hidden; + extern int require_seusers hidden; ++extern int selinux_page_size hidden; diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig.i libselinux-1.30.3/src/selinuxswig.i --- nsalibselinux/src/selinuxswig.i 2006-04-14 07:21:23.000000000 -0400 +++ libselinux-1.30.3/src/selinuxswig.i 2006-05-02 13:08:05.000000000 -0400 diff --git a/libselinux.spec b/libselinux.spec index c166467..b4aff54 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -113,6 +113,7 @@ exit 0 %changelog * Tue May 2 2006 Dan Walsh 1.30.3-2 - Add selinuxswig fixes +- Stop using PAGE_SIZE and start using sysconfig(_SC_PAGE_SIZE) * Fri Apr 14 2006 Dan Walsh 1.30.3-1 - Upgrade to latest from NSA