--- linux-2.4.22-oM3-orig/mm/mmap.c Tue Mar 30 16:00:08 2004 +++ linux-2.4.22-oM3-mod/mm/mmap.c Tue Mar 30 16:46:04 2004 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -559,8 +560,13 @@ int registration_result = 0; #endif /* CONFIG_MOSIX */ - if (file && (!file->f_op || !file->f_op->mmap)) - return -ENODEV; + if (file) { + if (!file->f_op || !file->f_op->mmap) + return -ENODEV; + + if ((prot & PROT_EXEC) && (file->f_vfsmnt) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC)) + return -EPERM; + } #ifdef CONFIG_MOSIX_FS if(file && file_is_mfs(file)) return(mmap_read_instead(file, addr, len, prot, flags, pgoff)); @@ -1390,6 +1396,9 @@ len = PAGE_ALIGN(len); if (!len) return addr; + + if ((addr + len) > TASK_SIZE || (addr + len) < addr) + return -EINVAL; #ifdef CONFIG_MOSIX if(current->mosix.dflags & DDEPUTY)