Received: by 2002:a05:6520:2586:b029:fa:41f3:c225 with SMTP id u6csp2027417lky; Fri, 25 Jun 2021 19:13:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2mh/bs4xXxVMlECCghk+lZSdjH3Ifh9Kwz4YUii09QRC6YAVa8AihkM3zorLxsTbTgBNC X-Received: by 2002:a02:b919:: with SMTP id v25mr12251675jan.120.1624673623202; Fri, 25 Jun 2021 19:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624673623; cv=none; d=google.com; s=arc-20160816; b=Qk+YpcagoWigrzQM4USGLETtD+DHM07T+4c40BPLtmQj8YxXfayiBhbMTHfL0bO8dN VmJbya+NcoUh0cGndqeKcS6rcgYQeItpDNef8rl+SqOWujSHlYgcPpXTVkONA6DtaXkY EpjJDCtPK7mIIp5XGf6shvhMpA0AJQX7kFDj6l19uKigBJwA45860wToICk3CVUIvsBA n+7r5ChDWI+BKzphSzqVYuKKwCfSVBd1JcdBGm/AiH0Ab1bGFvJCHrIqK4NrYXqqcDI1 24FIl8wiQ4MOass7clHXlrM6hQcGQzcAg2pbZvo6dOQKTS62Xemeq7gAXNlN0LhSMuCh Y29Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1r9fda5xI/fIh7bSJ74jyECq8A2FTtDKQSX+15pKXGQ=; b=ua/IvRurA0WshD21yoFXxOpUY4ztoNjf5Gwe4OIU5eIFIs/kNvdFey2Ydd1KbByUfg tXUdEFV+rfrLQJHhTgesqQlnNaA4ctR6S2sTraeq/8ZNebeL84ChlhSLU/Gmr1CYpApl 0GFXiFYfB1UpPTLE3Bik9H0v4gbs2cwqKYNfKLlqYBYUL3HhZ8SDC8XOZ8tHVtl8fQUJ 7IEOR9tpGS4RiL2x864rEvJ17Q7XGW8C9ItTRXGVjcfHtFas21fRiimQK55RkGlLT7BG 1aH+tJF24BnG7qOodBJOR1aXKLBhyLPHu72wQGp+dqs7EON+OweXMm/YlL4TnTjHUKZn GMag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Z7UIltlg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si7759926iof.33.2021.06.25.19.13.28; Fri, 25 Jun 2021 19:13:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Z7UIltlg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbhFZCIk (ORCPT + 99 others); Fri, 25 Jun 2021 22:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbhFZCIk (ORCPT ); Fri, 25 Jun 2021 22:08:40 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88FC2C061574 for ; Fri, 25 Jun 2021 19:06:17 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id h15so19442453lfv.12 for ; Fri, 25 Jun 2021 19:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1r9fda5xI/fIh7bSJ74jyECq8A2FTtDKQSX+15pKXGQ=; b=Z7UIltlgkmoVglUnL+W5so59xngkmaGjrNilGK5+1Pr/N7Bpe9av7CbiH7mf0wuBm1 ecMr0OyoJgta2kCfUvc28arqVCHXlBh/hrLEKop6ChNWVnOYzwOqvrWzFereIeFjZiUx pfKa3bxjQTkFvhFJztoflrLkHKVGqafNzFSUM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1r9fda5xI/fIh7bSJ74jyECq8A2FTtDKQSX+15pKXGQ=; b=p+si+xUfmv5HEw/mokUurVYD2MgKdu64WXLTwx1AURDIGPqE/1GAFSi195GxBLgeu9 F9/TdSDjU/P4aMOIslJJjpIRmg3Y4DfFi7qBJXNcoJvA2/7cMNS/N0RGEFl+ynFZ6h0V X7WgV/DXfNYRfXSoH4N2sbTaLsbJEbKNdeTm5gluGh4fXoPONXNQ4QgqYr/2sIjbZ/19 RajZfEqbBPSdn51Et6ULI0RB/00NQctZAF7JCmpHoeCtb/FfdMEznXunIz7OHSua7BzJ 8nabe18+ju1g4Yg4NLDw1zoHiCOZzMRHpp3Vv34ieglEfc7pitj2Xfv5CTDLRw7jERyi MShA== X-Gm-Message-State: AOAM532h0Mv594li9ok/aloBL1V2V0ji2MwqcmMaKLjP9U9D2sQ5hPHR MdZfDH8NPMUGC35lZM5/MTNuGpiJSl6bYk3Y X-Received: by 2002:a05:6512:2294:: with SMTP id f20mr9998127lfu.120.1624673175377; Fri, 25 Jun 2021 19:06:15 -0700 (PDT) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id b13sm657058lfo.104.2021.06.25.19.06.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Jun 2021 19:06:15 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id d25so15128145lji.7 for ; Fri, 25 Jun 2021 19:06:14 -0700 (PDT) X-Received: by 2002:a2e:a276:: with SMTP id k22mr10301538ljm.465.1624673174147; Fri, 25 Jun 2021 19:06:14 -0700 (PDT) MIME-Version: 1.0 References: <20210625163040.a15af04872959da9af161fca@linux-foundation.org> In-Reply-To: <20210625163040.a15af04872959da9af161fca@linux-foundation.org> From: Linus Torvalds Date: Fri, 25 Jun 2021 19:05:58 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] ELF: add and use SUPPRESS_WARN_UNUSED_RESULT To: Andrew Morton Cc: Alexey Dobriyan , Linux Kernel Mailing List , Miguel Ojeda , Al Viro Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 25, 2021 at 4:30 PM Andrew Morton wrote: > > I can't imagine who added this to load_elf_binary(): > > if (current->personality & MMAP_PAGE_ZERO) { > /* Why this, you ask??? Well SVr4 maps page 0 as read-only, > and some applications "depend" upon this behavior. > Since we do not have the power to recompile these, we > emulate the SVr4 behavior. Sigh. */ > error = vm_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC, > MAP_FIXED | MAP_PRIVATE, 0); > } > > I think it was there before most of us were born. The comment has a > torvaldsy/viroey feel to it. Heh. It goes back to at least 1.1.14 (1994, I think) and originates in the ibcs code (Intel Binary Compatibility Specification 2), back in the dark ages when we thought that mattered. Native Linux binaries were still a.out at that point. When ELF then became a native thing, we just moved (or copied) the old iBCS2 code over, and that "map zeroes at NULL" came along. And I think it's actually Eric Youngdale who did that code. See https://www.linuxjournal.com/article/2809 and https://www.linuxjournal.com/article/1059 https://www.linuxjournal.com/article/1060 > Do we really care about userspace which relies upon an SVR4 quirk? I > guess it's too hard to prove the no case, so it stays. I think we can safely remove it. Doing a mmap() at address zero will not actually work anyway in any half-way modern Linux environment. And I think the "map zeroes at NULL" wasn't even universal for SVr4. _Some_ binaries may have expected it, but I suspect it was the exception rather than the rule. So I'd happily take a patch that just removes it. If nothing else, it would be trivial to put back if somebody screams, but I seriously doubt that is going to happen. Linus