Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754060AbbKQRi3 (ORCPT ); Tue, 17 Nov 2015 12:38:29 -0500 Received: from mail-db3on0073.outbound.protection.outlook.com ([157.55.234.73]:14798 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751701AbbKQRi1 (ORCPT ); Tue, 17 Nov 2015 12:38:27 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@ezchip.com; Subject: Re: [PATCH] mm: fix incorrect behavior when process virtual address space limit is exceeded To: Oleg Nesterov , Piotr Kwapulinski References: <1447695379-14526-1-git-send-email-kwapulinski.piotr@gmail.com> <20151117161928.GA9611@redhat.com> CC: , , , , , , , , , , , , , , , , From: Chris Metcalf Message-ID: <564B6605.8080808@ezchip.com> Date: Tue, 17 Nov 2015 12:38:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151117161928.GA9611@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: BLUPR0101CA0035.prod.exchangelabs.com (25.163.116.173) To DB3PR02MB123.eurprd02.prod.outlook.com (10.141.3.21) X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB123;2:Aam4hdJH0tsBokwve0Wi2EHjIeLa+WovVkOcdsQu5dvi+0CpCf90T+QQg47deVhmtox3PDIa/yMXReXDls3WtS6HwjzUESLmOtt4TRLOHMb8lC8PnZYdVcajNG5vQT2pGit6FKDk3GmfsjHneyTvg7rf2ezZjYdh/I/2xdvGMNE=;3:+x1MceFtjegpT0tHGFiz/Zc54ZCNeSrJbcqyTBi/VU6hby1PbUhm337tl9q1tE3PUITviiHcGWHIC68WQozQyahmwY/5MmSyMn3iHchtHMRlFDEBiHRgPV3SSxVzQhZuzmeF26GqzI/6nh58Guqz/A==;25:RoaWtsl5S1EsUabnVqZcibvBFj8hcDoxGUym1oDB7pccnSckOelD3CgwCjmSKVqT/KSpmoVoCpyAdSVXYYOwunzC9Hswwa7twBysVg8+ePkETIQCn+IytjHrjAj/UgB5G0tSYmlLkaB1CGtXuVsKNR7tl2Cz/Ej9mwF2WkVsDlPwjnCEwWD1Jg5TACUy5NZ8oa9Xk5oIlsv1usICIyJjSBF0rNr6MDfDzYkwbacKWSu+G+dac0Y5XLJlidZpndSzV/xSafawdhH6Wf20jV5CAA==;20:yDuX7ELf/+ijY3OoK7SZNyh9xSUE1cGgkYgoMLoXzsCo7Ry7b2AzgL9SVNkHVjKjeTrlWiIkTryKPlSJZyBiK7yrtwyHZHTQIJCYPJBsWuehgDDQ58bdLX5HaZUEgJJ2Q+7xoR4H2ngnp/rSJWdC8R46N/jCYJ4+VQMj+kf9KH0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB123; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046);SRVR:DB3PR02MB123;BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB123; X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB123;4:DQ26dWfPxxBUk7UO7apnRoUw76dJZhlQ9nQOfvw31J5eX46x9bkbpe0HfyecPGv2GnPZlw17GqVXK48o/DTz8CkkZZD9Ghc6/hg2D5lCFFGByTl1i8eccO4KvKF+G/hz3j6Tt+lFVrERF93+kQKs4kOoxn+CoxfOxyptL8QlFwSppyMJPzux5XE7SxAHyVch6pY5J3ElNeJIrUQiP9HoNLzcMa1XHhounflX494kCNvczu/lAuNITOsfK+iPoRHbPrn4+XRNXagoGhC+mP2Fjev6/5Ei+KeyT7o0NsOz5bgfuccii9yiBIxV2phprZMYgDDThyKM1FnaHxG/RGDVED9Rjhc8fR+LCNWcO281aIJWjaffvyfBW7mJVPkvfytK X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(199003)(377454003)(189002)(479174004)(24454002)(83506001)(66066001)(4001350100001)(92566002)(5001770100001)(36756003)(230700001)(19580395003)(77096005)(33656002)(50466002)(59896002)(106356001)(81156007)(2950100001)(80316001)(65806001)(5004730100002)(47776003)(64126003)(76176999)(42186005)(40100003)(5008740100001)(97736004)(5001960100002)(87976001)(122386002)(50986999)(101416001)(5001920100001)(5007970100001)(87266999)(105586002)(15975445007)(23746002)(54356999)(189998001)(86362001)(65956001)(65816999)(586003)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB3PR02MB123;H:[10.7.0.41];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB3PR02MB123;23:N7n01AD+MXfSPvWAoh3LnIy22O47uheZZar0Oj?= =?Windows-1252?Q?6QnPGKLiF38SDExJDGARN76KYz0HJ20DW0LU8me/p3zV9bhjVEYRUs/s?= =?Windows-1252?Q?gPmgZYjXaEP4qbrSLaafItGzDCMSvRaztOCgHmQEeqwUnKnPmWLFc/N2?= =?Windows-1252?Q?/BbvcP4hgsNGJ3XlMAYXggksifkR316WpE0D/EJJntysiHUvICCgwvAv?= =?Windows-1252?Q?OBOCjUifRLQGb9j2ry4TcJZMU1/cUMWtWRfRt8oWP8/X4whl0cUcRmhz?= =?Windows-1252?Q?KOCHeDDg0sn2K4EVeADKegiIJxv3fJIgF34PdDJ2sCmielWBHdyeHTq7?= =?Windows-1252?Q?dgSNS7rBqDFxa9mowfGNEgxtVGa6zoWOoFTgwQVrIqMDF644d9DILUMa?= =?Windows-1252?Q?4uAGs4FCZyH1y9sHcZGNt6EyaCQwUSHzQC5M2sMPshMOQ47lHjoh4NIw?= =?Windows-1252?Q?+mPSuxSv5C+uHJCFvtlyhj6kNyJTN4lSRyfwpd/Y7/1Xj4EMWtfCz1fT?= =?Windows-1252?Q?PhvDfDC4sZJiebOFm9YnBbyNzhVNpyU7YOE0yavtKBF0t6k0Vd61W+3c?= =?Windows-1252?Q?Ffhuml3Z6/irzExh+1HBR27UEEhaCaou5yyN3z+9HYxnvgiJjH3jqXTG?= =?Windows-1252?Q?jhcR2O3/DBrGi4GDwRZznAKpsTBlfBWIK9gtnEn2C6bydDYequzO0hsA?= =?Windows-1252?Q?WxZR83zY8GbftNTTLItIf9C5j27VaqrQwjlXmzySHVhxtwz5gdRuEnCm?= =?Windows-1252?Q?RhCLH7I7egaS7VcuTW1QMmOuabL2Xf5L6MSxa6R17utOfUp7I3VEaWlu?= =?Windows-1252?Q?oDCznO/E86PFm37MnhtBtDqRKS0MgeVLQxOowz+ueN9fe2ZEFviYY+q9?= =?Windows-1252?Q?3TuggHu7VDhm9cLPtZWF6rfsC4G8DK0ie3kRqBT5HlkJYs5uTfHcAguG?= =?Windows-1252?Q?mue6UNZA+Zx3JaIvQh1zLOCBwrhUhnnqWWl99SpWoTyllziDp6VbeKzm?= =?Windows-1252?Q?uL22afyNFGV5Pr7Xwwxr+QgDePDBGv0NMFjV8YlhO2mcFyCXWEWncmeW?= =?Windows-1252?Q?zQ43pCSw5pao/cFPn9pnZJoGv2BlJk7ncaiTd/0ln58n2owbe4Qx7xXh?= =?Windows-1252?Q?U2sfUJCNoLFhSdp3qWyjX4xywID/0DtN2gsZDgR8MVrYF0P2pU4WvJEv?= =?Windows-1252?Q?JVe6JqtyY7bbk5c7cC+qjqPYab39LU5Sgg8MunclLdc1ovSqTei6F6rL?= =?Windows-1252?Q?BlYARELav28bi528ixkn1vYibpdBmss9vutOhaOzI57tVtkkxAU1Tpce?= =?Windows-1252?Q?QSCKJ8lCL4Jo9LGgWtKmlWRylvA3cPmGU14uUeCqZX1r87Yem3/+fOeW?= =?Windows-1252?Q?oGjf6l0/5Rxy5xrlCWMIPt//py5/90FrGgYtxRjuEUiL6Ehp/1hLXqeQ?= =?Windows-1252?Q?zhepBcPoWUDzfDkcK/?= X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB123;5:LaWG7jC4x8JUaEecbSrDER/XrVd51uroucsl/8OjP1O2rz1U5xPhStDx0eKAEJo2cPCF3oB7EMjx2yNChuTBOEuysk9aGX7VA2XB59MtOll9t0rtDHV8opp8EhbFR/9HaMSiE6LdrZR122YEGbPmCg==;24:qIOGltELbmvT3yHd+hY1kW5PG6EL7XOT3zolgguxkHtInn9rYZIE1W2VxEZQWJBPEj+p7NXoJ0O+qd3VoJp6fCUlLAhubEBEaE2WZm1miJg=;20:297GG5ENcqFSgQ2Xrk4xdlKsSbSwByOcXpheP9mMraJUdrazxIZZHb7qv5MlzfXuPmbR8CZFpbrSSW3BkJ6x9A== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2015 17:38:22.7887 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR02MB123 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1137 Lines: 27 On 11/17/2015 11:19 AM, Oleg Nesterov wrote: > On 11/16, Piotr Kwapulinski wrote: >> @@ -1551,7 +1552,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, >> * MAP_FIXED may remove pages of mappings that intersects with >> * requested mapping. Account for the pages it would unmap. >> */ >> - if (!(vm_flags & MAP_FIXED)) >> + if (!(flags & MAP_FIXED)) >> return -ENOMEM; > And afaics arch/tile/mm/elf.c can use do_mmap(MAP_FIXED ...) rather than > mmap_region(), it can be changed by a separate patch. In this case we can > unexport mmap_region(). The problem is that we are mapping a region of virtual address space that the chip provides for setting up interrupt handlers (at 0xfc000000) but that is above the TASK_SIZE cutoff, so do_mmap() would fail the call in get_unmapped_area(). -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/