Received: by 10.223.185.116 with SMTP id b49csp3213915wrg; Mon, 12 Feb 2018 22:50:31 -0800 (PST) X-Google-Smtp-Source: AH8x224mkF1n5s7thqymXESVcFMHqygFogGgt3md7Cwd4wx36gh6JIVBN33PtISphA8lWwTv7rmT X-Received: by 10.98.70.143 with SMTP id o15mr235743pfi.224.1518504631259; Mon, 12 Feb 2018 22:50:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518504631; cv=none; d=google.com; s=arc-20160816; b=o2A5jKEwZS2Lg/aNO2BG+s1WQt/vcomofJghQLh5xoljRXMFa1WpdilNzFur7vkxfW v65Y6cz3B7QqUmgzR6Qq/TpgtWQFd4lgRKJ5JX8UGoNts7Devs/sCQCJ5fCzL883hP5e sTpOeCZLLYL1Lj6T5ukcKolIdEYMVM0sEvGFzr/dOj1MzbYBq3FYnIFMROXSDM7ItGNf MuYQ3QzC8P/2U3xlIAKZXp6ye0URtw//PH5T7XMO/ZL0crr9bgBJ8o3+kXaNHWRbh73b Zem6c4YChaIfLk6TASrPzLfs8CktoXUDQsDaq19fTSlbqgJ/2IMLSb6fRyucLuOcn+qD 5plA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:from:cc:references:to :subject:arc-authentication-results; bh=Nmo9MATlf5b86wO6lmboKLnE9tm5YGbLnEMe2b7j6oU=; b=aHy4xsZRdZovFIZTO5IanjLafLoveTfPGjEtoz3CUZuwFBHYGy9d2FxIVSggmAecMO /on4hLHjqPkfKWyjzwEgN9mrikBA9OdSjVV3T8NZhBf8CHpH3COQFkIN60smnC7xkGRD LpyR0nKrCo6O8vFMr9+ARDe4Xbxelq0LXSEr3eGhViox5lDHm2Y7cEu0uWtvMLSwFqj3 H7JcZiNAV4ioRFhGPhGkBOiowRYHOy6uOV/eG4AUOoZk0dcOih88BxZkdG0MQcR2sZGk XYycWULgo2IppYaTSm2QqpWp9jGIViWOs7UNhFk5LEj0i4xH1QoPWqNgBhr8il67Qul9 0zdw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si3018793pge.767.2018.02.12.22.50.14; Mon, 12 Feb 2018 22:50:31 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933463AbeBMGth (ORCPT + 99 others); Tue, 13 Feb 2018 01:49:37 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51354 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933406AbeBMGte (ORCPT ); Tue, 13 Feb 2018 01:49:34 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1D6nHYi049944 for ; Tue, 13 Feb 2018 01:49:34 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g3tbchex3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 13 Feb 2018 01:49:33 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 Feb 2018 06:49:31 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 13 Feb 2018 06:49:27 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1D6nQZW46465242; Tue, 13 Feb 2018 06:49:26 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C99F04C04E; Tue, 13 Feb 2018 06:43:11 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 38FBE4C044; Tue, 13 Feb 2018 06:43:05 +0000 (GMT) Received: from localhost.localdomain (unknown [9.79.183.239]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 13 Feb 2018 06:43:04 +0000 (GMT) Subject: Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE To: Michal Hocko , Anshuman Khandual References: <5acba3c2-754d-e449-24ff-a72a0ad0d895@linux.vnet.ibm.com> <20180126140415.GD5027@dhcp22.suse.cz> <15da8c87-e6db-13aa-01c8-a913656bfdb6@linux.vnet.ibm.com> <6db9b33d-fd46-c529-b357-3397926f0733@linux.vnet.ibm.com> <20180129132235.GE21609@dhcp22.suse.cz> <87k1w081e7.fsf@concordia.ellerman.id.au> <20180130094205.GS21609@dhcp22.suse.cz> <5eccdc1b-6a10-b48a-c63f-295f69473d97@linux.vnet.ibm.com> <20180131131937.GA6740@dhcp22.suse.cz> <20180201134829.GL21609@dhcp22.suse.cz> Cc: Michael Ellerman , "akpm@linux-foundation.org" , mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-next@vger.kernel.org, sfr@canb.auug.org.au, broonie@kernel.org From: Anshuman Khandual Date: Tue, 13 Feb 2018 12:19:18 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20180201134829.GL21609@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18021306-0040-0000-0000-0000042F2C27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021306-0041-0000-0000-000020D2EE39 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-13_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802130085 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/2018 07:18 PM, Michal Hocko wrote: > On Thu 01-02-18 08:43:34, Anshuman Khandual wrote: > [...] >> $dmesg | grep elf_brk >> [ 9.571192] elf_brk 10030328 elf_bss 10030000 >> >> static int load_elf_binary(struct linux_binprm *bprm) >> --------------------- >> >> if (unlikely (elf_brk > elf_bss)) { >> unsigned long nbyte; >> >> /* There was a PT_LOAD segment with p_memsz > p_filesz >> before this one. Map anonymous pages, if needed, >> and clear the area. */ >> retval = set_brk(elf_bss + load_bias, >> elf_brk + load_bias, >> bss_prot); >> >> >> --------------------- > > Just a blind shot... Does the following make any difference? > --- > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c > index 021fe78998ea..04b24d00c911 100644 > --- a/fs/binfmt_elf.c > +++ b/fs/binfmt_elf.c > @@ -895,7 +895,7 @@ static int load_elf_binary(struct linux_binprm *bprm) > the correct location in memory. */ > for(i = 0, elf_ppnt = elf_phdata; > i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { > - int elf_prot = 0, elf_flags; > + int elf_prot = 0, elf_flags, elf_fixed = MAP_FIXED_NOREPLACE; > unsigned long k, vaddr; > unsigned long total_size = 0; > > @@ -927,6 +927,7 @@ static int load_elf_binary(struct linux_binprm *bprm) > */ > } > } > + elf_fixed = MAP_FIXED; > } > > if (elf_ppnt->p_flags & PF_R) > @@ -944,7 +945,7 @@ static int load_elf_binary(struct linux_binprm *bprm) > * the ET_DYN load_addr calculations, proceed normally. > */ > if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) { > - elf_flags |= MAP_FIXED_NOREPLACE; > + elf_flags |= elf_fixed; > } else if (loc->elf_ex.e_type == ET_DYN) { > /* > * This logic is run once for the first LOAD Program > @@ -980,7 +981,7 @@ static int load_elf_binary(struct linux_binprm *bprm) > load_bias = ELF_ET_DYN_BASE; > if (current->flags & PF_RANDOMIZE) > load_bias += arch_mmap_rnd(); > - elf_flags |= MAP_FIXED_NOREPLACE; > + elf_flags |= elf_fixed; > } else > load_bias = 0; > > Yeah, it does solve the problem on mmotm-2018-01-25-16-20.