Received: by 10.192.165.156 with SMTP id m28csp1127783imm; Wed, 18 Apr 2018 04:44:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx489Oc0DzJNtd96t4LM5EhEoiovbjxM8p5oFkbEYB+smGhcixFwqXRn+/ns7P9J0s/aontT/ X-Received: by 10.99.2.199 with SMTP id 190mr1524676pgc.11.1524051884342; Wed, 18 Apr 2018 04:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524051884; cv=none; d=google.com; s=arc-20160816; b=PdzID2/iwIaMq0uq7ZebBBdWJ42wHe2nVqWb4JpqDQBaCPqBdO1w1J7E3FASAj/qSN DxFGD1kLK3DjLjyA7fRYow99mjgzgpu2BBE2qWrNTayA5jv4+fNhT/0w7rcq8slbyPJx rEl+OktPfGYg8NFe1CdcTCBdRhaPY0B0bgOGOBYbXqlSD7QaJHZji20mi/6JoiO4Qf01 T9YaKtYmmMNwv4CKF3vELJAW0qcdCFpPS2vL8miUflhSZEGI2uLpIq7UzEp+hlvKAA8r LR2Vy9+7XDli2zbOai7XniNz7BYnHp5L/0HTe+FdwyHATbLHeRwAfw5cA4+sPDsO5052 LyTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:date:message-id:in-reply-to :references:from:subject:cc:to:arc-authentication-results; bh=J7NDlH15OV6LxwGTnQxIXUGLxAjyLJlYKLumUfuRxaY=; b=C1IJYtxPzfqkb4Aw6t9nWFZ0/KHUQCNJ/xXXAtEw/1vQn6WMQmSSarzGns5J2r/NPJ qDoJO2TrAn8Q8hR5gddel+qZAq7JcG44rP+4EduGTN6+iN4RuIiW/SdIPVyEv+A7Bw4U wsugcz8wo2do6/e1A5x/R3Cq+mWEjbvL1N0VLTdnYlj9usWjvuZOKp37GvFndn7UDqP6 2NTEEClT5CbUcs10HD16CWSmq9EvJTWjwMhjTYbZHSmThLHcloEL4ygUOwPxTouHV6XS vSBmwXuwasYyj6wFTjrF1iWViaCBicuEW2oGutvhFgGaV+nJkUO/qZs8007hATPA0XL9 wecg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p125si951882pga.503.2018.04.18.04.44.29; Wed, 18 Apr 2018 04:44:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753811AbeDRLnU (ORCPT + 99 others); Wed, 18 Apr 2018 07:43:20 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:14267 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753405AbeDRLnT (ORCPT ); Wed, 18 Apr 2018 07:43:19 -0400 Received: from fsav101.sakura.ne.jp (fsav101.sakura.ne.jp [27.133.134.228]) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w3IBhCs9063100; Wed, 18 Apr 2018 20:43:12 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav101.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav101.sakura.ne.jp); Wed, 18 Apr 2018 20:43:12 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav101.sakura.ne.jp) Received: from AQUA (softbank126099184120.bbtec.net [126.99.184.120]) (authenticated bits=0) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w3IBhCB6063097; Wed, 18 Apr 2018 20:43:12 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) To: mhocko@kernel.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] fs, elf: drop MAP_FIXED usage from elf_map From: Tetsuo Handa References: <20171213092550.2774-1-mhocko@kernel.org> <20171213092550.2774-3-mhocko@kernel.org> <0b5c541a-91ee-220b-3196-f64264f9f0bc@I-love.SAKURA.ne.jp> <20180418113301.GY17484@dhcp22.suse.cz> In-Reply-To: <20180418113301.GY17484@dhcp22.suse.cz> Message-Id: <201804182043.JFH90161.LStOOMFFOJQHVF@I-love.SAKURA.ne.jp> X-Mailer: Winbiff [Version 2.51 PL2] X-Accept-Language: ja,en,zh Date: Wed, 18 Apr 2018 20:43:11 +0900 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michal Hocko wrote: > > Don't complain if IS_ERR_VALUE(), > > this is simply wrong. We do want to warn on the failure because this is > when the actual clash happens. We should just warn on EEXIST. >From 25442cdd31aa5cc8522923a0153a77dfd2ebc832 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Wed, 18 Apr 2018 20:38:15 +0900 Subject: [PATCH] fs, elf: don't complain MAP_FIXED_NOREPLACE unless -EEXIST error. Commit 4ed28639519c7bad ("fs, elf: drop MAP_FIXED usage from elf_map") is printing spurious messages under memory pressure due to map_addr == -ENOMEM. 9794 (a.out): Uhuuh, elf segment at 00007f2e34738000(fffffffffffffff4) requested but the memory is mapped already 14104 (a.out): Uhuuh, elf segment at 00007f34fd76c000(fffffffffffffff4) requested but the memory is mapped already 16843 (a.out): Uhuuh, elf segment at 00007f930ecc7000(fffffffffffffff4) requested but the memory is mapped already Complain only if -EEXIST, and use %px for printing the address. Signed-off-by: Tetsuo Handa Cc: Michal Hocko Cc: Andrei Vagin Cc: Khalid Aziz Cc: Michael Ellerman Cc: Kees Cook Cc: Abdul Haleem Cc: Joel Stanley Cc: Anshuman Khandual --- fs/binfmt_elf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 41e0418..96615d9 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -377,10 +377,9 @@ static unsigned long elf_map(struct file *filep, unsigned long addr, } else map_addr = vm_mmap(filep, addr, size, prot, type, off); - if ((type & MAP_FIXED_NOREPLACE) && BAD_ADDR(map_addr)) - pr_info("%d (%s): Uhuuh, elf segment at %p requested but the memory is mapped already\n", - task_pid_nr(current), current->comm, - (void *)addr); + if ((type & MAP_FIXED_NOREPLACE) && map_addr == -EEXIST) + pr_info("%d (%s): Uhuuh, elf segment at %px requested but the memory is mapped already\n", + task_pid_nr(current), current->comm, (void *)addr); return(map_addr); } -- 1.8.3.1