From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f182.google.com (mail-ig0-f182.google.com [209.85.213.182]) by kanga.kvack.org (Postfix) with ESMTP id 66C246B0031 for ; Tue, 15 Jul 2014 07:33:30 -0400 (EDT) Received: by mail-ig0-f182.google.com with SMTP id c1so2785257igq.15 for ; Tue, 15 Jul 2014 04:33:30 -0700 (PDT) Received: from mail-ie0-x235.google.com (mail-ie0-x235.google.com [2607:f8b0:4001:c03::235]) by mx.google.com with ESMTPS id v8si24260083icx.92.2014.07.15.04.33.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jul 2014 04:33:29 -0700 (PDT) Received: by mail-ie0-f181.google.com with SMTP id rp18so4372389iec.40 for ; Tue, 15 Jul 2014 04:33:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20140715105547.C4832E00A3@blue.fi.intel.com> References: <748020aaaf5c5c2924a16232313e0175.squirrel@webmail.tu-dortmund.de> <20140715105547.C4832E00A3@blue.fi.intel.com> Date: Tue, 15 Jul 2014 15:33:29 +0400 Message-ID: Subject: Re: PROBLEM: repeated remap_file_pages on tmpfs triggers bug on process exit From: Konstantin Khlebnikov Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: "Kirill A. Shutemov" Cc: Hugh Dickins , Ingo Korb , Ning Qu , Dave Jones , Sasha Levin , Andrew Morton , "linux-mm@kvack.org" , Linux Kernel Mailing List On Tue, Jul 15, 2014 at 2:55 PM, Kirill A. Shutemov wrote: > Konstantin Khlebnikov wrote: >> It seems boundng logic in do_fault_around is wrong: >> >> start_addr = max(address & fault_around_mask(), vma->vm_start); >> off = ((address - start_addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); >> pte -= off; >> pgoff -= off; >> >> Ok, off <= 511, but it might be bigger than pte offset in pte table. > > I don't see how it possible: fault_around_mask() cannot be more than 0x1ff000 > (x86-64, fault_around_bytes == 2M). It means start_addr will be aligned to 2M > boundary in this case which is start of the page table pte belong to. > > Do I miss something? Nope, you're right. This fixes kernel crash but not the original problem. Problem is caused by calling do_fault_around for _non-linear_ faiult. In this case pgoff is shifted and might become negative during calculation. I'll send another patch. > > -- > Kirill A. Shutemov -- 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