From owner-freebsd-emulation@FreeBSD.ORG Wed May 21 05:23:03 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16A051065670 for ; Wed, 21 May 2008 05:23:03 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.184]) by mx1.freebsd.org (Postfix) with ESMTP id 91B6C8FC15 for ; Wed, 21 May 2008 05:23:02 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by nf-out-0910.google.com with SMTP id h3so1330310nfh.33 for ; Tue, 20 May 2008 22:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:cc:subject:in-reply-to:message-id:references:user-agent:mime-version:content-type:from; bh=YPqFgJ+++Uvy5tGJxfbVd9aXpcN8AKCjeNjA+iHySIQ=; b=QB+XkhTV064Z4ZDEs7GruT5Avc8J3r7jg3XjcyAcIqlv9uBj68/azjV5yRWat+zYlKgFPhDgTtLGTncTUmhov+VWymVBml+xSkUrdFkQ+1ghDAjgo4olE22AXkx/pA88rkUfj4roRxbuhm4mJjUXqc74bp5I/ZAhgNX6XQUKqPQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:cc:subject:in-reply-to:message-id:references:user-agent:mime-version:content-type:from; b=SzsDZj+iLVOaBJj3OZhwa0NYXJUpGx/CLQ5lTXejB0NJc0L/Yu6vGh52LQlibNMoyENJnQawmRVGbTWbtakC/PQPG5j4oyDjLZ105HHaEsKTg+V9905TUEGeonIEVN5mD1RB1Le8dkxk6xL7fFXtPwsrT+I6NOrIWtZ3wFkI2mk= Received: by 10.210.25.2 with SMTP id 2mr8930349eby.29.1211347381209; Tue, 20 May 2008 22:23:01 -0700 (PDT) Received: from ora.chd.net ( [81.200.6.196]) by mx.google.com with ESMTPS id z40sm1085833ikz.7.2008.05.20.22.22.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 20 May 2008 22:22:58 -0700 (PDT) Date: Wed, 21 May 2008 01:09:17 +0400 (MSD) cc: freebsd-emulation@freebsd.org In-Reply-To: <200805191106.m4JB6oBF011533@freefall.freebsd.org> Message-ID: References: <200805191106.m4JB6oBF011533@freefall.freebsd.org> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII From: Chagin Dmitry Subject: Re: Current problem reports assigned to freebsd-emulation@FreeBSD.org X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 May 2008 05:23:03 -0000 On Mon, 19 May 2008, FreeBSD bugmaster wrote: > Current FreeBSD problem reports > Critical problems > Serious problems > > S Tracker Resp. Description > -------------------------------------------------------------------------------- > o kern/21463 emulation [linux] Linux compatability mode should not allow setu > o kern/97326 emulation [linux] file descriptor leakage in linux emulation > o kern/117010 emulation [linux] linux_getdents() get something like buffer ove > about 117010... Can somebody test this patch on amd64 and i386? It is necessary linux_base-f8, 2.6.16, -current. thnx! diff --git a/src/sys/compat/linux/linux_file.c b/src/sys/compat/linux/linux_file.c index a843659..0acd07f 100644 --- a/src/sys/compat/linux/linux_file.c +++ b/src/sys/compat/linux/linux_file.c @@ -240,6 +240,7 @@ linux_lseek(struct thread *td, struct linux_lseek_args *args) return error; } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) int linux_llseek(struct thread *td, struct linux_llseek_args *args) { @@ -278,6 +279,7 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args) lda.count = 1; return linux_getdents(td, &lda); } +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ /* * Note that linux_getdents(2) and linux_getdents64(2) have the same @@ -289,7 +291,7 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args) */ struct l_dirent { - l_long d_ino; + l_ino_t d_ino; l_off_t d_off; l_ushort d_reclen; char d_name[LINUX_NAME_MAX + 1]; @@ -536,6 +538,7 @@ linux_getdents64(struct thread *td, struct linux_getdents64_args *args) return (getdents_common(td, args, 1)); } + /* * These exist mainly for hooks for doing /compat/linux translation. */ @@ -905,6 +908,7 @@ linux_truncate(struct thread *td, struct linux_truncate_args *args) return (error); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) int linux_truncate64(struct thread *td, struct linux_truncate64_args *args) { @@ -922,6 +926,8 @@ linux_truncate64(struct thread *td, struct linux_truncate64_args *args) LFREEPATH(path); return (error); } +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ + int linux_ftruncate(struct thread *td, struct linux_ftruncate_args *args) { @@ -1119,6 +1125,7 @@ linux_mount(struct thread *td, struct linux_mount_args *args) return (error); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) int linux_oldumount(struct thread *td, struct linux_oldumount_args *args) { @@ -1128,6 +1135,7 @@ linux_oldumount(struct thread *td, struct linux_oldumount_args *args) args2.flags = 0; return (linux_umount(td, &args2)); } +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ int linux_umount(struct thread *td, struct linux_umount_args *args) @@ -1258,7 +1266,7 @@ bsd_to_linux_flock64(struct flock *bsd_flock, struct l_flock64 *linux_flock) #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ static int -fcntl_common(struct thread *td, struct linux_fcntl64_args *args) +fcntl_common(struct thread *td, struct linux_fcntl_args *args) { struct l_flock linux_flock; struct flock bsd_flock; @@ -1382,17 +1390,13 @@ fcntl_common(struct thread *td, struct linux_fcntl64_args *args) int linux_fcntl(struct thread *td, struct linux_fcntl_args *args) { - struct linux_fcntl64_args args64; #ifdef DEBUG if (ldebug(fcntl)) printf(ARGS(fcntl, "%d, %08x, *"), args->fd, args->cmd); #endif - args64.fd = args->fd; - args64.cmd = args->cmd; - args64.arg = args->arg; - return (fcntl_common(td, &args64)); + return (fcntl_common(td, args)); } #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) @@ -1401,6 +1405,7 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args) { struct l_flock64 linux_flock; struct flock bsd_flock; + struct linux_fcntl_args fcntl_args; int error; #ifdef DEBUG @@ -1441,7 +1446,10 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args) (intptr_t)&bsd_flock)); } - return (fcntl_common(td, args)); + fcntl_args.fd = args->fd; + fcntl_args.cmd = args->cmd; + fcntl_args.arg = args->arg; + return (fcntl_common(td, &fcntl_args)); } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ -- Have fun! chd