Re: 2.6.8-rc3-mm2

William Lee Irwin III
2004-08-09T08:52:35Z

On Sun, Aug 08, 2004 at 03:29:36PM -0700, Andrew Morton wrote:
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.8-rc3/2.6.8-rc3-mm2/
> - Added a little patch to the CPU scheduler which disables its array
> switching.
[...]

During the kernel summit, some discussion was had about the support
requirements for a userspace program loader that loads executables
into hugetlb on behalf of a major application (Oracle). In order to
support this in a robust fashion, the cleanup of the hugetlb must be
robust in the presence of disorderly termination of the programs
(e.g. kill -9). Hence, the cleanup semantics are those of System V
shared memory, but Linux' System V shared memory needs one critical
extension for this use: executability.

The following microscopic patch enables this major application to
provide robust hugetlb cleanup.

Index: premm2-2.6.8-rc3/include/linux/shm.h
===================================================================
--- premm2-2.6.8-rc3.orig/include/linux/shm.h 2004-08-07 02:17:59.231816608 -0700
+++ premm2-2.6.8-rc3/include/linux/shm.h 2004-08-07 03:46:10.163472736 -0700
@@ -44,6 +44,7 @@
#define SHM_RDONLY 010000 /* read-only access */
#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
#define SHM_REMAP 040000 /* take-over region on attach */
+#define SHM_EXEC 0100000 /* execution access */

/* super user shmctl commands */
#define SHM_LOCK 11
Index: premm2-2.6.8-rc3/ipc/shm.c
===================================================================
--- premm2-2.6.8-rc3.orig/ipc/shm.c 2004-08-07 02:17:59.395791680 -0700
+++ premm2-2.6.8-rc3/ipc/shm.c 2004-08-07 02:58:23.613254608 -0700
@@ -688,6 +688,10 @@
o_flags = O_RDWR;
acc_mode = S_IRUGO | S_IWUGO;
}
+ if (shmflg & SHM_EXEC) {
+ prot |= PROT_EXEC;
+ acc_mode |= S_IXUGO;
+ }

/*
* We cannot rely on the fs check since SYSV IPC does have an