Received: by 10.223.164.202 with SMTP id h10csp355789wrb; Mon, 13 Nov 2017 07:32:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMYYM73tHAOspW+NShxa71k9hae3Gb+ODlkpldMuMkczbkG19FF27IiO/FBaIxR8viy2dn+H X-Received: by 10.99.125.23 with SMTP id y23mr7914323pgc.345.1510587159167; Mon, 13 Nov 2017 07:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510587159; cv=none; d=google.com; s=arc-20160816; b=S8HA5/q2cLZePdEGW7/Jrszu3uQWVRVODM66M23UwZ0ZPhEtdn8KoboXS4NQsY6DC7 8gQIVFP6kindNHlPpMhjNk9eq9ZgXkucvqjeq/VSFP0DJEgJ5YRBbhoXxAlpLzSedt9a N+xQWRKbweVcj8Vh2u7sk3ZQ+1aM5SBrgG2s3rYzCBELV402uK18Otn6ZQKN5PcXsRWK KhqIYdoTUcfwc569owprVup3ickBQAly3ENimx/+/cWLKEB8K4zn6mDqoKC5tVbcZdl+ VuAocK+n1K0Oh9TDVjPTPKrCSD9z/Xj6NVkUn+HtkozHEBLi+ggZU/MkckR+6eqnb9mC Zx/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=AK9EdjdmHLrWiNKPSyxVg2JJyOnVokBcEbR/uOcyq3c=; b=IBQ2aqrVrqGzsnU9xhxaRb9SuDd9VMZ3JgZrf8Iuh6LuBQQELsnYuSFg0QFPBvnLEn y9bjgyj0u5U21C6NGXe0zmbV4+Wi+Sncp7roCNAQJrlPLJR/dDAws8MCaSP9vCo4eUvN MwhAVF3b+RF5324C/BI3skkOGdLqmbhKNSAQjk9kiDSY8ds5YATmT/kv+WjLPBRz/j4G a8ODBXdkV1VWU0pDnXk2H8urTo1sHO6j3fLFDxbYoQx89Ewi04I6QyJtmrbBZESllH5V yoyMSoIquw/yHXn/RtBlxbS7uxe+eNEsZ5tehc3ZtwUeHUDpJwYix1QeBBG+O0IF7QNI R2kQ== 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 g3si14290236plb.276.2017.11.13.07.32.26; Mon, 13 Nov 2017 07:32:39 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753243AbdKMPbq (ORCPT + 88 others); Mon, 13 Nov 2017 10:31:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:60556 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbdKMPbo (ORCPT ); Mon, 13 Nov 2017 10:31:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 39FDFAAEF; Mon, 13 Nov 2017 15:31:43 +0000 (UTC) Date: Mon, 13 Nov 2017 16:31:42 +0100 From: Michal Hocko To: Russell King - ARM Linux Cc: Joel Stanley , Stephen Rothwell , Andrew Morton , Linux-Next Mailing List , Linux Kernel Mailing List , linux-arm-kernel@lists.infradead.org, Benjamin Herrenschmidt , Michael Ellerman , Abdul Haleem , linuxppc-dev@lists.ozlabs.org Subject: Re: linux-next: Tree for Nov 7 Message-ID: <20171113153142.aoznpjivgjjihlef@dhcp22.suse.cz> References: <20171107162217.382cd754@canb.auug.org.au> <20171108142050.7w3yliulxjeco3b7@dhcp22.suse.cz> <20171110123054.5pnefm3mczsfv7bz@dhcp22.suse.cz> <20171113092006.cjw2njjukt6limvb@dhcp22.suse.cz> <20171113141140.cns5fxt5jg4zdedb@dhcp22.suse.cz> <20171113150908.GL12318@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171113150908.GL12318@n2100.armlinux.org.uk> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 13-11-17 15:09:09, Russell King - ARM Linux wrote: > On Mon, Nov 13, 2017 at 03:11:40PM +0100, Michal Hocko wrote: > > On Mon 13-11-17 10:20:06, Michal Hocko wrote: > > > [Cc arm and ppc maintainers] > > > > > > Thanks a lot for testing! > > > > > > On Sun 12-11-17 11:38:02, Joel Stanley wrote: > > > > On Fri, Nov 10, 2017 at 11:00 PM, Michal Hocko wrote: > > > > > Hi Joel, > > > > > > > > > > On Wed 08-11-17 15:20:50, Michal Hocko wrote: > > > > > [...] > > > > >> > There are a lot of messages on the way up that look like this: > > > > >> > > > > > >> > [ 2.527460] Uhuuh, elf segement at 000d9000 requested but the > > > > >> > memory is mapped already > > > > >> > [ 2.540160] Uhuuh, elf segement at 000d9000 requested but the > > > > >> > memory is mapped already > > > > >> > [ 2.546153] Uhuuh, elf segement at 000d9000 requested but the > > > > >> > memory is mapped already > > > > >> > > > > > >> > And then trying to run userspace looks like this: > > > > >> > > > > >> Could you please run with debugging patch posted > > > > >> http://lkml.kernel.org/r/20171107102854.vylrtaodla63kc57@dhcp22.suse.cz > > > > > > > > > > Did you have chance to test with this debugging patch, please? > > > > > > > > Lots of this: > > > > > > > > [ 1.177266] Uhuuh, elf segement at 000d9000 requested but the memory is mapped already, got 000dd000 > > > > [ 1.177555] Clashing vma [dd000, de000] flags:100873 name:(null) > > > > > > This smells like the problem I've expected that mmap with hint doesn't > > > respect the hint even though there is no clashing mapping. The above > > > basically says that we didn't map at 0xd9000 but it has placed it at > > > 0xdd000. The nearest (clashing) vma is at 0xdd000 so this is our new > > > mapping. find_vma returns the closest vma (with addr < vm_end) for the > > > given address 0xd9000 so this address cannot be mapped by any other vma. > > > > > > Now that I am looking at arm's arch_get_unmapped_area it does perform > > > aligning for shared vmas. > > > > Sorry for confusion here. These are not shared mappings as pointed out > > by Russell in a private email. I got confused by the above flags which I > > have misinterpreted as bit 0 set => MAP_SHARED. These are vm_flags > > obviously so the bit 0 is VM_READ. Sorry about the confusion. The real > > reason we are doing the alignment is that we do a file mapping > > /* > > * We only need to do colour alignment if either the I or D > > * caches alias. > > */ > > if (aliasing) > > do_align = filp || (flags & MAP_SHARED); > > > > I am not really familiar with this architecture to understand why do we > > need aliasing for file mappings, though. > > I think it's there so that flush_dcache_page() works - possibly > get_user_pages() being used on a private mapping of page cache pages, > but that's guessing. I fail to see how the mixure of MAP_FIXED and regular mapping of the same file work then, but as I've said I really do not understand this code. > I'm afraid I don't remember all the details, this is code from around > 15 years ago, and I'd be very nervous about changing it now without > fully understanding the issues. Ohh, absolutely! I didn't dare to touch this code and that's why I took the easy way and simply opt-out from the harding for all those archs that are basically sharing this pattern. But after a closer look it seems that we can really introduce MAP_FIXED_SAFE that would keep the arch mmap code intact yet we would get the hardening for all archs. It would allow also allow a safer MAP_FIXED semantic for userspace. -- Michal Hocko SUSE Labs From 1583964557224138598@xxx Mon Nov 13 15:18:36 +0000 2017 X-GM-THRID: 1583423641769727671 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread