From owner-freebsd-emulation@freebsd.org Sun Jun 11 08:37:45 2017 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79A12C31EE9 for ; Sun, 11 Jun 2017 08:37:45 +0000 (UTC) (envelope-from u-klys@aetey.se) Received: from outgoing.fripost.org (giraff.fripost.org [178.16.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C16483EEE for ; Sun, 11 Jun 2017 08:37:44 +0000 (UTC) (envelope-from u-klys@aetey.se) Received: from localhost (localhost [127.0.0.1]) by outgoing.fripost.org (Postfix) with ESMTP id 2A0A5C6FF59 for ; Sun, 11 Jun 2017 10:37:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fripost.org; h= content-disposition:content-type:content-type:mime-version :message-id:subject:subject:from:from:date:date; s=20140703; t= 1497170263; x=1498984664; bh=mrV/xfYnVRA4ABKUgUTdH6TCphOHJQ/JWt3 PH/thCRQ=; b=LbZv8br7vopHroFYHs6hVgMNbWhoj0aEHfv5Rec+ORznl2ffN9n m5pBIhnCK2unQl9YeekWLxF8Lh4yOlwQ5ckhqcXlKltO7S/5MribFNS0rWiqB3E3 UyRFtTwpLZ2ebrXyihqP0NvT891U3Ww0xxDU5p7tXWSlqNxSm2G1VLmQ= X-Virus-Scanned: Debian amavisd-new at fripost.org Received: from outgoing.fripost.org ([127.0.0.1]) by localhost (giraff.fripost.org [127.0.0.1]) (amavisd-new, port 10040) with LMTP id OCXSsQpg4evU for ; Sun, 11 Jun 2017 10:37:43 +0200 (CEST) Received: from smtp.fripost.org (unknown [172.16.0.6]) by outgoing.fripost.org (Postfix) with ESMTP id 096EBC6FF56 for ; Sun, 11 Jun 2017 10:37:43 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by smtp.fripost.org (Postfix) with ESMTPSA id 4C4A22D6B01D for ; Sun, 11 Jun 2017 10:37:34 +0200 (CEST) Received: (qmail 23062 invoked from network); 11 Jun 2017 08:33:37 -0000 Received: from localhost (HELO aetey.se) (eh1ba719@127.0.0.1) by mail with ESMTPA; 11 Jun 2017 08:33:37 -0000 Date: Sun, 11 Jun 2017 10:37:17 +0200 From: u-klys@aetey.se To: freebsd-emulation@freebsd.org Subject: linux_mremap() with MREMAP_MAYMOVE - not implemented? Message-ID: <20170611083717.GM30784@example.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.23 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: Sun, 11 Jun 2017 08:37:45 -0000 Hello, I am to run Linux binaries (i386) under FreeBSD 11.0-RELEASE (amd64). The behaviour which surprises me is as follows $ truss ./rea linux_set_thread_area(0xffffcc3c) = 0 (0x0) linux_set_tid_address(0x804fb2c) = 75293 (0x1261d) linux_mmap2(0x0,0x101000,0x3,0x22,0xffffffff,0x0) = 671412224 (0x2804f000) linux_mremap(0x2804f000,0x101000,0x201000,0x1,0x0) ERR#-12 'Cannot allocate memory' linux_ioctl(0x1,0x5413,0xffffcae4) = 0 (0x0) FAILED REALLOCATING from 1 M to 2 M linux_writev(0x1,0xffffcab4,0x2) = 35 (0x23) linux_exit_group(0x0) process exit, rval = 0 $ The test binary is compiled under Linux from $ cat rea.c #include #include #define DELTA (1024*1024) int main( int argc, char **argv ){ unsigned int i = DELTA; char *p, *q; if( !(p = malloc(i)) ) return 1; while( (q=realloc(p, (i+=DELTA))) ) p = q; printf("FAILED REALLOCATING from %u M to %u M\n", i/DELTA-1, i/DELTA); return 0; } $ and statically linked against musl standard C library which relies on mremap() in its malloc implementation. Is support for MREMAP_MAYMOVE missing? Regards, Rune