lkml.org 
[lkml]   [1999]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] depricate ZMAGIC binaries
Date
In article <linux.kernel.m1btfbsk67.fsf@flinx.ccr.net>,
Eric W. Biederman <ebiederm+eric@ccr.net> wrote:
>
>
>The follow patch reads ZMAGIC binaries into anonymous memory,
>instead of mapping them at weird offsets in the page cache.
>
>It now also issues a warning when they are run.

The warning is bad juju -- having my logs fill up with useless
complaints is somewhat less than optimal.

Here's the same patch, but made less judgemental:


diff -uNrX linux-ignore-files linux-2.3.3.eb1/fs/binfmt_aout.c linux-2.3.3.eb2/fs/binfmt_aout.c
--- linux-2.3.3.eb1/fs/binfmt_aout.c Sun May 16 21:55:18 1999
+++ linux-2.3.3.eb2/fs/binfmt_aout.c Tue May 18 01:12:47 1999
@@ -413,7 +413,7 @@
return fd;
file = fcheck(fd);

- if (!file->f_op || !file->f_op->mmap) {
+ if (!file->f_op || !file->f_op->mmap || ((fd_offset & ~PAGE_MASK) != 0)) {
sys_close(fd);
do_mmap(NULL, 0, ex.a_text+ex.a_data,
PROT_READ|PROT_WRITE|PROT_EXEC,
@@ -534,6 +541,20 @@

start_addr = ex.a_entry & 0xfffff000;

+ if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
+
+ do_mmap(NULL, start_addr & PAGE_MASK, ex.a_text + ex.a_data + ex.a_bss,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_FIXED| MAP_PRIVATE, 0);
+
+ read_exec(file->f_dentry, N_TXTOFF(ex),
+ (char *)start_addr, ex.a_text + ex.a_data, 0);
+ flush_icache_range((unsigned long) start_addr,
+ (unsigned long) start_addr + ex.a_text + ex.a_data);
+
+ retval = 0;
+ goto out_putf;
+ }
/* Now use mmap to map the library into memory. */
error = do_mmap(file, start_addr, ex.a_text + ex.a_data,
PROT_READ | PROT_WRITE | PROT_EXEC,
diff -uNrX linux-ignore-files linux-2.3.3.eb1/mm/filemap.c linux-2.3.3.eb2/mm/filemap.c
--- linux-2.3.3.eb1/mm/filemap.c Tue May 18 01:11:52 1999
+++ linux-2.3.3.eb2/mm/filemap.c Tue May 18 01:12:47 1999
@@ -1319,8 +1319,7 @@
return -EINVAL;
} else {
ops = &file_private_mmap;
- if (inode->i_op && inode->i_op->bmap &&
- (vma->vm_offset & (inode->i_sb->s_blocksize - 1)))
+ if (vma->vm_offset & (PAGE_SIZE -1))
return -EINVAL;
}
if (!inode->i_sb || !S_ISREG(inode->i_mode))

____
david parsons \bi/ You'll get my ZMAGIC binaries when you pry them out
\/ of my cold dead hands.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.031 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site