From owner-freebsd-hackers@freebsd.org Thu Oct 15 14:54:53 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B11B440858 for ; Thu, 15 Oct 2020 14:54:53 +0000 (UTC) (envelope-from karnajitw@gmail.com) Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBsl03RTcz4Zhd for ; Thu, 15 Oct 2020 14:54:52 +0000 (UTC) (envelope-from karnajitw@gmail.com) Received: by mail-yb1-xb32.google.com with SMTP id s89so2462539ybi.12 for ; Thu, 15 Oct 2020 07:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=i0zO9Cn1oj8fB9IrEFK0QyrPmOYuH/vG8YFuoIu1Nfs=; b=tP+Z1Jb6VR5USJlcDMRQaCsy+CXaqa6mHKWEs0tK6+t0mHi1poYps/spkwzry/HBuB ap09ES0v6tkU9cfAzLvWDptedgpSGpYRKvCw+z0uSlgCEDm+P/Jx6zba3vlJPjj37u3C iFScOHBwYOYpXEaULrvDCKGo7U+zuiKVZmd9rkYf4TpX71CdmQwGd2d8+YpIitoLmRNl 1SL5UbEVzQ+ZvRaDhvhp+37uMc4NwHVFx2whdwzx74pg6mSfDbgxItBMSyDXEdf5Y2ds gYSeFPuXqk5Q8m7czx2jZcQzJEOFo+J3yBEZSq5kI31tznZtHoFznPmmUAYLI67WCdSA Dv2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=i0zO9Cn1oj8fB9IrEFK0QyrPmOYuH/vG8YFuoIu1Nfs=; b=VC4mq8bcozi9JLKmMQH/Mnw31kaR0hsVL/ooVeusJz0XovXq0bJcUM25kDIi+bB1i+ I6Ekaup9KpIo1RFhk0AZHB4y2zwaZVUb8N55nVVPTCM0OurvGQXh10DshzAb3qgiX9v/ qE2i/podAX76YSFubOdufqeMg3xY1kl/8A/KrZ0oG7S/z2c5lp40oUk80xvkcdyU+m0b vcf5nbt/ALLQqSk7ncLpPnNWTp19ZL6cIiCYw+RiLlT28Mpecxg8D+ewMFqgEUKoSiz6 ZPS15idqWTP7xkot6348QG1o/z8EBiREqQmS/wexGSRk0Hg+3tfuPRFc9RlC8uiFX1BX Kh6g== X-Gm-Message-State: AOAM531WgMW7rtQy9skL96XQlHizNewvV5ptZV0EPmLdcUHgBIwtogLd buEkZReHR3Lk4jwWlGFyhqhljXoaHI48dx5ATuJm8akC51RsL7pkf5k= X-Google-Smtp-Source: ABdhPJxXiFoGppknuCE76yFEEBXzt3NOP+1IvIZPSgL4srUh91F1pgxCJOu3E6HunHwZmHr+O/Q74ZjOqoOp2BVWAd8= X-Received: by 2002:a05:6902:4b0:: with SMTP id r16mr1065924ybs.150.1602773690889; Thu, 15 Oct 2020 07:54:50 -0700 (PDT) MIME-Version: 1.0 From: karnajit wangkhem Date: Thu, 15 Oct 2020 20:24:39 +0530 Message-ID: Subject: Extra memory mapping seen on freebsd-12 which was not seen in freebsd-11 To: freebsd-hackers@freebsd.org X-Rspamd-Queue-Id: 4CBsl03RTcz4Zhd X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=tP+Z1Jb6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of karnajitw@gmail.com designates 2607:f8b0:4864:20::b32 as permitted sender) smtp.mailfrom=karnajitw@gmail.com X-Spamd-Result: default: False [-3.85 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.945]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b32:from]; NEURAL_HAM_SHORT(-0.91)[-0.910]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-hackers]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2020 14:54:53 -0000 Hi freebsd team, While checking on a valgrind issue, I encountered the following mapping of a simple test program on a freebsd-12. Below is the procstat -v output I took by breaking on _rtld. [Stable 12] # procstat -v 76573 PID START END PRT RES PRES REF SHD FLAG TP PATH 76573 0x800227000 0x800229000 rw- 1 1 1 0 ----- df 76573 0x7fffdffff000 0x7ffffffdf000 --- 0 0 0 0 ----- -- <<< This ~511MB memory segment 76573 0x7ffffffdf000 0x7ffffffff000 rw- 1 1 1 0 ---D- df 76573 0x7ffffffff000 0x800000000000 r-x 1 1 99 0 ----- ph [Stable 11] # procstat -v 85507 PID START END PRT RES PRES REF SHD FLAG TP PATH 85507 0x800820000 0x800822000 rw- 1 1 1 0 ---- df 85507 0x7ffffffdf000 0x7ffffffff000 rw- 1 1 1 0 ---D df 85507 0x7ffffffff000 0x800000000000 r-x 1 1 104 0 ---- ph There is an extra ~511MB reserved mmap area starting at 0x7fffdffff000 in stable 12. Could you please give me an insight of what this is for and is it ok for a userspace program to modify this mapping? The reason is that our applications reserve some fixed memory that crosses/modify the above region. As this mapping was not called by the client program, valgrind had taken control of it. So, I have to decide whether to give the control to the client and allow modifications(mprotect, unmap, mmap, etc) on this memory segment or logically(not mandatorily) a client program should be allowed to modify this area? Regards, Karan