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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3D69CCF9E9 for ; Thu, 26 Sep 2024 08:47:05 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4XDnK41s8Gz2y89; Thu, 26 Sep 2024 18:47:04 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1727340424; cv=none; b=YOSUgL++DtgxtgGE0FVG1nYwGSPAuJAM6sgymXP6u4EN4m2kNN1ndCtXD2Q7ddlhS8LfvCojF+BLiS20FA7cakDYGPIH3n/NjePHrjVQ+qO+pLKpjyaGbmBny70eoAKUheOpdtnemiQkAkJ39yYOY+DJtG8UCw7SZyPposrubiNY2FjJ6YhF6xcf5qxG3TWuHSeliFQ3Ou5S4QoMQxOXu4FtWEuqa3MEP5KFTNXO9qDb+RGuqTv8jiSfg79gTRdNO0RtEdIQs2roD6GxJwE8vT/natMrFX1R4pejB85CsSo0vG2LgDU9zTyWMSWXfNajF25DsdQ1l7LYsTp09hNayg== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1727340424; c=relaxed/relaxed; bh=dcdT+Y+JTqgEdFx8AuCpVRjLlJoZMsxN/9BPx+44vCo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=D1znTSr9hFxeoDb9WQyHm2Zy4V/u3WKiwmfCeN4NrTcbUMnGkxUKF/LBU/coh5peCZMwkCxfn+YY7hiBnGw89u0r1FQPyn5mP9y6CcHpXoqXCV+f5884Z56DIbkgsXIox3UKz+J1ZAYRu6wDn27UQc/X9YJrm5PyGF+2GGm/dUd/4GD/uPw1uMG/SixHRuFOBQTwBWmXgZXpWGAsCnvJVIQ1Qibv8MU8ndDISHXOGXKUgdwakUayOYIqJShe+XYxljRYk5eFN27d9SG4j8NherUnM6xUSpIMYbz9jTfkKu6bNrZb2p0R/R5CVI8aONx8C+9JemR3Sakbpz60lUZbIQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b2R010Cd; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b2R010Cd; dkim-atps=neutral; spf=pass (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david@redhat.com; receiver=lists.ozlabs.org) smtp.mailfrom=redhat.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b2R010Cd; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b2R010Cd; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4XDnK33w4xz2xrM for ; Thu, 26 Sep 2024 18:47:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727340417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=dcdT+Y+JTqgEdFx8AuCpVRjLlJoZMsxN/9BPx+44vCo=; b=b2R010CdmuI448+ZEeEbtzcxWGrIw1lWsFPsOdz2KRHY+Pq6vosutUC9lPCfh2Wkot5/vW rTBX4Z2fgaPhTKhyDQtOMbwJcieNvQ3c8nyvkqAmWSo1+xtsDzkJcQNpt2vZ7HzCC4wrda EEjDF7mg7SMfiRwXGdlpmIhKE/OIjeU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727340417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=dcdT+Y+JTqgEdFx8AuCpVRjLlJoZMsxN/9BPx+44vCo=; b=b2R010CdmuI448+ZEeEbtzcxWGrIw1lWsFPsOdz2KRHY+Pq6vosutUC9lPCfh2Wkot5/vW rTBX4Z2fgaPhTKhyDQtOMbwJcieNvQ3c8nyvkqAmWSo1+xtsDzkJcQNpt2vZ7HzCC4wrda EEjDF7mg7SMfiRwXGdlpmIhKE/OIjeU= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-xiUddJKRODiE41YULjWUTA-1; Thu, 26 Sep 2024 04:46:55 -0400 X-MC-Unique: xiUddJKRODiE41YULjWUTA-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-37cd19d0e83so104788f8f.2 for ; Thu, 26 Sep 2024 01:46:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727340415; x=1727945215; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=dcdT+Y+JTqgEdFx8AuCpVRjLlJoZMsxN/9BPx+44vCo=; b=GALUZHHorogKqMrvV7VgzbOLlOaIwJ+/sQT2wBQd30+75UgmHYwHFBNmCbNNk/TYdB rFmOOkL9PJjX6TxxM8sEPU712wVH8gw6nuRSPLKxKYveTwiz/Ak24WqmGqLVQifjKSTP n0VlEKj7VyChXNk+o6dll7vTOK/ABjiBSdETdaM9y+1PcjlWvxKbMXW4YBc89Noof+hj ML6Wzgtn+g+hocq1oKDDBNzI7+prDW6AidK86aE9+kVu0DWbb/+RQXdfSNujKxfKasFT t6Ey8W1Y2l/58tZtEU67cAxvw0ECVyY5PmKb4cWRmSKaEIDexiQ4PzKMuCqVRksZp++P CAcg== X-Forwarded-Encrypted: i=1; AJvYcCXQltw9yPpWyU59y44K80JwKiVk0KF/JUmnoSnzZ77DLqwJSPRZ0wxqOqG42Cg8w+IZk3t9eh/ZrGDtZmA=@lists.ozlabs.org X-Gm-Message-State: AOJu0Yyv+Ex76zJ9xyZiz3G+4uCAT20qDamW7GAXKdBriGheQKMqJsEA 1XT0fdntUJqD1Oy4qgOm85shJS7m5rDCZv1UyXkxo8NlnL32j/YM76VqXp/61+kuNKoKvmCJ0qz GBi2wUZxnGNIFLVA/OO+j9ejHuYLbsyupn8zTp42qZy8vaBrpLPBrfNpjWOaG4ic= X-Received: by 2002:a5d:4642:0:b0:374:c07c:a49 with SMTP id ffacd0b85a97d-37cc248b745mr3395750f8f.28.1727340414660; Thu, 26 Sep 2024 01:46:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8YDSVOdNq1/t7E3SyZWe5lFPiCsLTZcolGEYAEKQa215yfM+Vw1+QC4KOFxSiwJu3877rJg== X-Received: by 2002:a5d:4642:0:b0:374:c07c:a49 with SMTP id ffacd0b85a97d-37cc248b745mr3395735f8f.28.1727340414264; Thu, 26 Sep 2024 01:46:54 -0700 (PDT) Received: from ?IPV6:2003:cb:c744:ac00:ef5c:b66d:1075:254a? (p200300cbc744ac00ef5cb66d1075254a.dip0.t-ipconnect.de. [2003:cb:c744:ac00:ef5c:b66d:1075:254a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e969ffa22sm40374455e9.25.2024.09.26.01.46.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Sep 2024 01:46:53 -0700 (PDT) Message-ID: Date: Thu, 26 Sep 2024 10:46:50 +0200 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Post: List-Subscribe: , , List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/5] [RFC] mm: Remove MAP_UNINITIALIZED support To: Arnd Bergmann , linux-mm@kvack.org Cc: Arnd Bergmann , "Jason A. Donenfeld" , Alexander Viro , Alexandre Torgue , Andreas Larsson , Andrew Morton , Ard Biesheuvel , Christian Brauner , Christoph Hellwig , Christophe Leroy , Damien Le Moal , Greg Ungerer , Helge Deller , Kees Cook , "Liam R . Howlett" , Lorenzo Stoakes , Matt Turner , Max Filippov , Michael Ellerman , Michal Hocko , Nicholas Piggin , Richard Henderson , Thomas Bogendoerfer , Vladimir Murzin , Vlastimil Babka , linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org References: <20240925210615.2572360-1-arnd@kernel.org> <20240925210615.2572360-6-arnd@kernel.org> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+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kFnMEbo9Zu9w7Kv AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3 AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240925210615.2572360-6-arnd@kernel.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 25.09.24 23:06, Arnd Bergmann wrote: > From: Arnd Bergmann > > MAP_UNINITIALIZED was added back in 2009 for NOMMU kernels, specifically > for blackfin, which is long gone. MAP_HUGE_SHIFT/MAP_HUGE_MASK were > added in 2012 for architectures supporting hugepages, which at the time > did not overlap with the ones supporting NOMMU. > > Adding the macro under an #ifdef was obviously a mistake, which > Christoph Hellwig tried to address by making it unconditionally defined > to 0x4000000 as part of the series to support RISC-V NOMMU kernels. At > this point linux/mman.h contained two conflicting definitions for bit 26, > though the two are still mutually exclusive at runtime in all supported > configurations. > > According to the commit 854e9ed09ded ("mm: support madvise(MADV_FREE)") > description, it was previously used internally by facebook, which > would have resulted in MAP_HUGE_1MB turning into MAP_HUGE_2MB > with MAP_UNINITIALIZED enabled, and every other page size implying > MAP_UNINITIALIZED. I assume there are no remaining out of tree users > on MMU-enabled kernels today. > > I do not see any sensible way to redefine the macros for the ABI in > a way avoids breaking something. The only ideas so far are: > > - do nothing, try to document the bug, hope for the best > > - remove the kernel implementation and redefine MAP_UNINITIALIZED to > zero in the header to silently turn it off for everyone. There are > few NOMMU users left, and the ones that do use NOMMU usually turn > off MMAP_ALLOW_UNINITIALIZED, as it still has the potential to cause > bugs and even security issues on systems with a memory protection > unit. > > - remove both the implementation and the macro to force a build > failure for anyone trying to use the feature. This way we can > see who complains and whether we need to put it back in some > form or change the userspace sources to no longer pass the flag. > The first, uncontroversial step could indeed be to make MAP_UNINITIALIZED a nop, but still leave the definitions in mman.h etc around. This is the same we did with MAP_DENYWRITE. There might be some weird user out there, and carelessly reusing the bit could result in trouble. (people might argue that they are not using it with MAP_HUGETLB, so it would work) Going forward and removing MAP_UNINITIALIZED is a bit more controversial, but maybe there really isn't any other user around. Software that is not getting recompiled cannot be really identified by letting it rest in -next only. My take would be to leave MAP_UNINITIALIZED in the headers in some form for documentation purposes. -- Cheers, David / dhildenb