From owner-p4-projects@FreeBSD.ORG Fri Jan 26 05:01:12 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 63E2B16A402; Fri, 26 Jan 2007 05:01:12 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1CE9016A404 for ; Fri, 26 Jan 2007 05:01:12 +0000 (UTC) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id E917E13C489 for ; Fri, 26 Jan 2007 05:01:11 +0000 (UTC) (envelope-from jkim@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0Q51Bvh035958 for ; Fri, 26 Jan 2007 05:01:11 GMT (envelope-from jkim@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0Q51Bp2035953 for perforce@freebsd.org; Fri, 26 Jan 2007 05:01:11 GMT (envelope-from jkim@freebsd.org) Date: Fri, 26 Jan 2007 05:01:11 GMT Message-Id: <200701260501.l0Q51Bp2035953@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jkim@freebsd.org using -f From: Jung-uk Kim To: Perforce Change Reviews Cc: Subject: PERFORCE change 113546 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2007 05:01:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=113546 Change 113546 by jkim@jkim_hammer on 2007/01/26 05:00:44 Stop mimicking Linux mmap behavior and use Linux/ia64 wisdom. Many Linux/i386 distros have shown different mmap behaviors. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#29 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#23 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#29 (text+ko) ==== @@ -852,12 +852,14 @@ bsd_args.flags |= MAP_STACK; /* - * Linux has added READ_IMPLIES_EXEC personality but we do not support - * the feature yet. We just assume READ_IMPLIES_EXEC is always on. + * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC + * on Linux/i386. We do this to ensure maximum compatibility. + * Linux/ia64 does the same in i386 emulation mode. */ bsd_args.prot = linux_args->prot; - if (bsd_args.prot & PROT_READ) - bsd_args.prot |= PROT_EXEC; + if ((bsd_args.prot & PROT_WRITE) || + (bsd_args.prot & (PROT_READ | PROT_EXEC))) + bsd_args.prot |= PROT_READ | PROT_EXEC; if (linux_args->fd != -1) { /* @@ -977,9 +979,9 @@ bsd_args.addr = uap->addr; bsd_args.len = uap->len; bsd_args.prot = uap->prot; - /* XXX PROT_READ implies PROT_EXEC; see linux_mmap_common(). */ - if (bsd_args.prot & PROT_READ) - bsd_args.prot |= PROT_EXEC; + if ((bsd_args.prot & PROT_WRITE) || + (bsd_args.prot & (PROT_READ | PROT_EXEC))) + bsd_args.prot |= PROT_READ | PROT_EXEC; return (mprotect(td, &bsd_args)); } ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#23 (text+ko) ==== @@ -653,12 +653,14 @@ bsd_args.flags |= MAP_STACK; /* - * Linux has added READ_IMPLIES_EXEC personality but we do not support - * the feature yet. We just assume READ_IMPLIES_EXEC is always on. + * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC + * on Linux/i386. We do this to ensure maximum compatibility. + * Linux/ia64 does the same in i386 emulation mode. */ bsd_args.prot = linux_args->prot; - if (bsd_args.prot & PROT_READ) - bsd_args.prot |= PROT_EXEC; + if ((bsd_args.prot & PROT_WRITE) || + (bsd_args.prot & (PROT_READ | PROT_EXEC))) + bsd_args.prot |= PROT_READ | PROT_EXEC; if (linux_args->fd != -1) { /* @@ -778,9 +780,9 @@ bsd_args.addr = uap->addr; bsd_args.len = uap->len; bsd_args.prot = uap->prot; - /* XXX PROT_READ implies PROT_EXEC; see linux_mmap_common(). */ - if (bsd_args.prot & PROT_READ) - bsd_args.prot |= PROT_EXEC; + if ((bsd_args.prot & PROT_WRITE) || + (bsd_args.prot & (PROT_READ | PROT_EXEC))) + bsd_args.prot |= PROT_READ | PROT_EXEC; return (mprotect(td, &bsd_args)); }