From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F314C46467 for ; Tue, 10 Jan 2023 20:58:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EAB9F8E0002; Tue, 10 Jan 2023 15:58:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E5B3E8E0001; Tue, 10 Jan 2023 15:58:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D49BA8E0002; Tue, 10 Jan 2023 15:58:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C34B48E0001 for ; Tue, 10 Jan 2023 15:58:15 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7B33980399 for ; Tue, 10 Jan 2023 20:58:15 +0000 (UTC) X-FDA: 80340102150.16.601BEE1 Received: from mail.itouring.de (mail.itouring.de [85.10.202.141]) by imf27.hostedemail.com (Postfix) with ESMTP id 7EF9340011 for ; Tue, 10 Jan 2023 20:58:13 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=applied-asynchrony.com; spf=pass (imf27.hostedemail.com: domain of holger@applied-asynchrony.com designates 85.10.202.141 as permitted sender) smtp.mailfrom=holger@applied-asynchrony.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673384294; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=nGxYoF+S7OqbsVvCk44HCQjWG4ipMDvYNuA57CDXx+8=; b=xPabwzO9clSGDHp80XgLwsuCL2LdArrIwWizBLGzoNGPL3PFsRMJBLwbbsqTHT7jS25mlq 0am47yFV3KC8lOE/S85QoaGPHI1Lwg/TbzEBi75dNRdh6Ahv8vOz18TnHVtsLKFL7hZtWp wVHtS4amfWYCPTuvhQmzBEhrgVvnlWs= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=applied-asynchrony.com; spf=pass (imf27.hostedemail.com: domain of holger@applied-asynchrony.com designates 85.10.202.141 as permitted sender) smtp.mailfrom=holger@applied-asynchrony.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673384294; a=rsa-sha256; cv=none; b=UkaYcFCbrAG4WmPqR5fSvVxf768Ip9TtokeyGYEFE16ZSf1LmSN7CVp2/rvfuzYV18ihOH IKKgWR1vPW3TpDfxtulbLmpCyq9e+ufaSD90YezjfIBl8rS+rBPpEWODJpb52Fn7alZcLg ZXbbsRwWLMU2nCyC/gz/XbECrn3bnhk= Received: from tux.applied-asynchrony.com (p5ddd742f.dip0.t-ipconnect.de [93.221.116.47]) by mail.itouring.de (Postfix) with ESMTPSA id A5604127843 for ; Tue, 10 Jan 2023 21:58:11 +0100 (CET) Received: from [192.168.100.221] (hho.applied-asynchrony.com [192.168.100.221]) by tux.applied-asynchrony.com (Postfix) with ESMTP id 62034F01581 for ; Tue, 10 Jan 2023 21:58:11 +0100 (CET) To: linux-mm From: =?UTF-8?Q?Holger_Hoffst=c3=a4tte?= Organization: Applied Asynchrony, Inc. Subject: mmap in 6.0 vs. 6.1: apparent behaviour change wrt. MAP_FAILED & errno Message-ID: <6c1932ac-3cea-5ccf-202d-38358b08deec@applied-asynchrony.com> Date: Tue, 10 Jan 2023 21:58:11 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: r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A5kWnm33jkt sog== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000029, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hello, I have a question about an unexplained behaviour change of mmap(). The llvm project has a test case [1] that runs mmap in order to verify that address ranges can be accessed..or something; I don't really understand what the purpose is, but that's also beside the point. It was recently found that this test fails when run on 6.1 but succeeds by booting back to 6.0 [2]. This made me curious and you can find the investigation on the bug. What I would like to learn is the *intended* value of errno for mmap() hitting mmap_min_addr and returning MAP_FAILED when running as non-root. As my last comment indicates it looks like errno was ENOMEM and is now EPERM, failing the assert. IMHO EPERM makes sense but the exact side effects of MAP_FAILED are not really well documented; hitting mmap_min_addr seems to be a grey area. I poked around the mm subtree and found the EPERM addition from (I think) 2019; maybe this test was never run since then? The test can be run standalone by downloading mmap.c and test.h from the same directory, and compiling with 'clang++ -fsanitize=memory mmap.cpp'. Adding the perror() from my comment makes the behaviour a bit more visible. Like I said, I don't know whether the test is even correct to begin with - I'm just trying to add context to the bug so that a committer can fix it. Thanks for any input! Holger [1] https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/msan/mmap.cpp [2] https://github.com/llvm/llvm-project/issues/59717