From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751429AbeA2FcW (ORCPT ); Mon, 29 Jan 2018 00:32:22 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53366 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeA2FcT (ORCPT ); Mon, 29 Jan 2018 00:32:19 -0500 Subject: Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE To: Anshuman Khandual , Michal Hocko References: <20180109161355.GL1732@dhcp22.suse.cz> <20180117080731.GA2900@dhcp22.suse.cz> <082aa008-c56a-681d-0949-107245603a97@linux.vnet.ibm.com> <20180123124545.GL1526@dhcp22.suse.cz> <20180123160653.GU1526@dhcp22.suse.cz> <2a05eaf2-20fd-57a8-d4bd-5a1fbf57686c@linux.vnet.ibm.com> <20180124090539.GH1526@dhcp22.suse.cz> <5acba3c2-754d-e449-24ff-a72a0ad0d895@linux.vnet.ibm.com> <20180126140415.GD5027@dhcp22.suse.cz> <15da8c87-e6db-13aa-01c8-a913656bfdb6@linux.vnet.ibm.com> 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: Mon, 29 Jan 2018 11:02:09 +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: <15da8c87-e6db-13aa-01c8-a913656bfdb6@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18012905-0016-0000-0000-0000051CCBA3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18012905-0017-0000-0000-000028596258 Message-Id: <6db9b33d-fd46-c529-b357-3397926f0733@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-29_03:,, 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=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801290075 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/29/2018 08:17 AM, Anshuman Khandual wrote: > On 01/26/2018 07:34 PM, Michal Hocko wrote: >> On Fri 26-01-18 18:04:27, Anshuman Khandual wrote: >> [...] >>> I tried to instrument mmap_region() for a single instance of 'sed' >>> binary and traced all it's VMA creation. But there is no trace when >>> that 'anon' VMA got created which suddenly shows up during subsequent >>> elf_map() call eventually failing it. Please note that the following >>> VMA was never created through call into map_region() in the process >>> which is strange. >> >> Could you share your debugging patch? > > Please find the debug patch at the end. > >> >>> ================================================================= >>> [ 9.076867] Details for VMA[3] c000001fce42b7c0 >>> [ 9.076925] vma c000001fce42b7c0 start 0000000010030000 end 0000000010040000 >>> next c000001fce42b580 prev c000001fce42b880 mm c000001fce40fa00 >>> prot 8000000000000104 anon_vma (null) vm_ops (null) >>> pgoff 1003 file (null) private_data (null) >>> flags: 0x100073(read|write|mayread|maywrite|mayexec|account) >>> ================================================================= >> >> Isn't this vdso or some other special mapping? It is not really an >> anonymous vma. Please hook into __install_special_mapping > > Yeah, will do. Its not an anon mapping as it does not have a anon_vma > structure ? Okay, this colliding VMA seems to be getting loaded from load_elf_binary() function as well. [ 9.422410] vma c000001fceedbc40 start 0000000010030000 end 0000000010040000 next c000001fceedbe80 prev c000001fceedb700 mm c000001fceea8200 prot 8000000000000104 anon_vma (null) vm_ops (null) pgoff 1003 file (null) private_data (null) flags: 0x100073(read|write|mayread|maywrite|mayexec|account) [ 9.422576] CPU: 46 PID: 7457 Comm: sed Not tainted 4.14.0-dirty #158 [ 9.422610] Call Trace: [ 9.422623] [c000001fdc4f79b0] [c000000000b17ac0] dump_stack+0xb0/0xf0 (unreliable) [ 9.422670] [c000001fdc4f79f0] [c0000000002dafb8] do_brk_flags+0x2d8/0x440 [ 9.422708] [c000001fdc4f7ac0] [c0000000002db3d0] vm_brk_flags+0x80/0x130 [ 9.422747] [c000001fdc4f7b20] [c0000000003d23a4] set_brk+0x80/0xdc [ 9.422785] [c000001fdc4f7b60] [c0000000003d1f24] load_elf_binary+0x1304/0x158c [ 9.422830] [c000001fdc4f7c80] [c00000000035d3e0] search_binary_handler+0xd0/0x270 [ 9.422881] [c000001fdc4f7d10] [c00000000035f338] do_execveat_common.isra.31+0x658/0x890 [ 9.422926] [c000001fdc4f7df0] [c00000000035f980] SyS_execve+0x40/0x50 [ 9.423588] [c000001fdc4f7e30] [c00000000000b220] system_call+0x58/0x6c which is getting hit after adding some more debug. @@ -2949,6 +2997,13 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long if (flags & VM_LOCKED) mm->locked_vm += (len >> PAGE_SHIFT); vma->vm_flags |= VM_SOFTDIRTY; + + if (!strcmp(current->comm, "sed")) { + if (just_init && (mm_ptr == vma->vm_mm)) { + dump_vma(vma); + dump_stack(); + } + } return 0; } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE To: Anshuman Khandual , Michal Hocko References: <20180109161355.GL1732@dhcp22.suse.cz> <20180117080731.GA2900@dhcp22.suse.cz> <082aa008-c56a-681d-0949-107245603a97@linux.vnet.ibm.com> <20180123124545.GL1526@dhcp22.suse.cz> <20180123160653.GU1526@dhcp22.suse.cz> <2a05eaf2-20fd-57a8-d4bd-5a1fbf57686c@linux.vnet.ibm.com> <20180124090539.GH1526@dhcp22.suse.cz> <5acba3c2-754d-e449-24ff-a72a0ad0d895@linux.vnet.ibm.com> <20180126140415.GD5027@dhcp22.suse.cz> <15da8c87-e6db-13aa-01c8-a913656bfdb6@linux.vnet.ibm.com> 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: Mon, 29 Jan 2018 11:02:09 +0530 MIME-Version: 1.0 In-Reply-To: <15da8c87-e6db-13aa-01c8-a913656bfdb6@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Message-Id: <6db9b33d-fd46-c529-b357-3397926f0733@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: On 01/29/2018 08:17 AM, Anshuman Khandual wrote: > On 01/26/2018 07:34 PM, Michal Hocko wrote: >> On Fri 26-01-18 18:04:27, Anshuman Khandual wrote: >> [...] >>> I tried to instrument mmap_region() for a single instance of 'sed' >>> binary and traced all it's VMA creation. But there is no trace when >>> that 'anon' VMA got created which suddenly shows up during subsequent >>> elf_map() call eventually failing it. Please note that the following >>> VMA was never created through call into map_region() in the process >>> which is strange. >> >> Could you share your debugging patch? > > Please find the debug patch at the end. > >> >>> ================================================================= >>> [ 9.076867] Details for VMA[3] c000001fce42b7c0 >>> [ 9.076925] vma c000001fce42b7c0 start 0000000010030000 end 0000000010040000 >>> next c000001fce42b580 prev c000001fce42b880 mm c000001fce40fa00 >>> prot 8000000000000104 anon_vma (null) vm_ops (null) >>> pgoff 1003 file (null) private_data (null) >>> flags: 0x100073(read|write|mayread|maywrite|mayexec|account) >>> ================================================================= >> >> Isn't this vdso or some other special mapping? It is not really an >> anonymous vma. Please hook into __install_special_mapping > > Yeah, will do. Its not an anon mapping as it does not have a anon_vma > structure ? Okay, this colliding VMA seems to be getting loaded from load_elf_binary() function as well. [ 9.422410] vma c000001fceedbc40 start 0000000010030000 end 0000000010040000 next c000001fceedbe80 prev c000001fceedb700 mm c000001fceea8200 prot 8000000000000104 anon_vma (null) vm_ops (null) pgoff 1003 file (null) private_data (null) flags: 0x100073(read|write|mayread|maywrite|mayexec|account) [ 9.422576] CPU: 46 PID: 7457 Comm: sed Not tainted 4.14.0-dirty #158 [ 9.422610] Call Trace: [ 9.422623] [c000001fdc4f79b0] [c000000000b17ac0] dump_stack+0xb0/0xf0 (unreliable) [ 9.422670] [c000001fdc4f79f0] [c0000000002dafb8] do_brk_flags+0x2d8/0x440 [ 9.422708] [c000001fdc4f7ac0] [c0000000002db3d0] vm_brk_flags+0x80/0x130 [ 9.422747] [c000001fdc4f7b20] [c0000000003d23a4] set_brk+0x80/0xdc [ 9.422785] [c000001fdc4f7b60] [c0000000003d1f24] load_elf_binary+0x1304/0x158c [ 9.422830] [c000001fdc4f7c80] [c00000000035d3e0] search_binary_handler+0xd0/0x270 [ 9.422881] [c000001fdc4f7d10] [c00000000035f338] do_execveat_common.isra.31+0x658/0x890 [ 9.422926] [c000001fdc4f7df0] [c00000000035f980] SyS_execve+0x40/0x50 [ 9.423588] [c000001fdc4f7e30] [c00000000000b220] system_call+0x58/0x6c which is getting hit after adding some more debug. @@ -2949,6 +2997,13 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long if (flags & VM_LOCKED) mm->locked_vm += (len >> PAGE_SHIFT); vma->vm_flags |= VM_SOFTDIRTY; + + if (!strcmp(current->comm, "sed")) { + if (just_init && (mm_ptr == vma->vm_mm)) { + dump_vma(vma); + dump_stack(); + } + } return 0; } -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org