Messages in this thread Patch in this message |  | | From | Michael Meskes <> | Subject | Patches to 2.1.5 | Date | Tue, 22 Oct 1996 13:07:25 +0200 (MET DST) |
| |
Hi,
here are two minor patches to make ipx resp. appletalk work under 2.1.5 as modules. I'm currently not connected to the internet so I don't know if these patches are already in. I also include my patch to binfmt_elf that causes the kernel to report ENOMEM in case a binary has too big a data segment. I still think we should report 'Out of memory' instead of just dumping core.
Michael
--- linux/net/ipx/af_ipx.c.old Tue Oct 22 08:33:05 1996 +++ linux/net/ipx/af_ipx.c Tue Oct 22 09:10:59 1996 @@ -1036,6 +1036,7 @@ ipxitf_ioctl_real(unsigned int cmd, void *arg) { int err; + char c; switch(cmd) { case SIOCSIFADDR: @@ -1087,12 +1088,14 @@ err=verify_area(VERIFY_READ,arg,sizeof(char)); if(err) return err; - return ipxcfg_set_auto_create(get_fs_byte(arg)); + get_user(c, (char *)arg); + return ipxcfg_set_auto_create(c); case SIOCAIPXPRISLT: err=verify_area(VERIFY_READ,arg,sizeof(char)); if(err) return err; - return ipxcfg_set_auto_select(get_fs_byte(arg)); + get_user(c, (char *)arg); + return ipxcfg_set_auto_select(c); default: return -EINVAL; } @@ -1626,7 +1629,7 @@ err=verify_area(VERIFY_READ,optval,sizeof(int)); if(err) return err; - opt=get_fs_long((unsigned long *)optval); + get_user(opt, (int *)optval); switch(level) { --- linux/net/appletalk/ddp.c.old Tue Oct 22 08:33:48 1996 +++ linux/net/appletalk/ddp.c Tue Oct 22 09:10:13 1996 @@ -1027,7 +1027,7 @@ err=verify_area(VERIFY_READ,optval,sizeof(int)); if(err) return err; - opt=get_fs_long((unsigned long *)optval); + get_user(opt, (int *)optval); switch(level) { --- linux/fs/binfmt_elf.c.old Tue Oct 22 09:23:14 1996 +++ linux/fs/binfmt_elf.c Tue Oct 22 09:35:49 1996 @@ -7,6 +7,7 @@ * Tools". * * Copyright 1993, 1994: Eric Youngdale (ericy@cais.com). + * Added resource limits check: Michael Meskes (meskes@debian.org) */ #include <linux/module.h> @@ -378,8 +379,9 @@ unsigned long elf_entry, interp_load_addr = 0; int status; unsigned long start_code, end_code, end_data; - unsigned long elf_stack; + unsigned long elf_stack, datasize; char passed_fileno[6]; + unsigned long rlim; ibcs2_interpreter = 0; status = 0; @@ -544,6 +546,24 @@ return -E2BIG; } } + + /* MM: Check if we extend resource limits */ + /* Algorithm proposed by Richard Henderson <rth@tamu.edu> */ + rlim = current->rlim[RLIMIT_DATA].rlim_cur; + if (rlim >= RLIM_INFINITY) + rlim = ~0; + elf_ppnt = elf_phdata; + datasize = 0; + for(i=0;i < elf_ex.e_phnum; i++){ + if(elf_ppnt->p_flags & PF_W) { + unsigned long new_data_size = datasize + elf_ppnt->p_memsz; + if (new_data_size > rlim || new_data_size < datasize) + return -ENOMEM; + datasize = new_data_size; + } + elf_ppnt++; + } + /* MM: End */ /* OK, This is the point of no return */ flush_old_exec(bprm); -- Michael Meskes | _____ ________ __ ____ meskes@informatik.rwth-aachen.de | / ___// ____/ // / / __ \___ __________ meskes@sanet.de | \__ \/ /_ / // /_/ /_/ / _ \/ ___/ ___/ meskes@debian.org | ___/ / __/ /__ __/\__, / __/ / (__ ) Use Debian GNU/Linux! | /____/_/ /_/ /____/\___/_/ /____/
|  |