From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0856FC433E1 for ; Mon, 18 May 2020 11:13:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A34AE2070A for ; Mon, 18 May 2020 11:13:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="HQzjzokg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A34AE2070A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=szeredi.hu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2E581900003; Mon, 18 May 2020 07:13:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26F83900002; Mon, 18 May 2020 07:13:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 15DDC900003; Mon, 18 May 2020 07:13:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id EDA8A900002 for ; Mon, 18 May 2020 07:13:00 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A744B181AC217 for ; Mon, 18 May 2020 11:13:00 +0000 (UTC) X-FDA: 76829577720.25.spade87_374abfa7bc224 X-HE-Tag: spade87_374abfa7bc224 X-Filterd-Recvd-Size: 4605 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 May 2020 11:12:59 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id b91so8123910edf.3 for ; Mon, 18 May 2020 04:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dCv2ZdCkY0qCMhbqU1FXB8Pdv4mOdNVdXKMY2xRHask=; b=HQzjzokgi4lY9NYMTDDWBnXLzsdgSdzg0fwgxvoGbCjB/wGQGnntdVBl/4A7CgVANm t3RUM/EjHKkPSlqHctqbr2W5sp+MBsczfHXSRCjcs6P89C6emJ0hte/tS14gz7/RIsxZ YycgIpnRwaXsSRc2T3Kp4LrhTaaSiLX11dq5w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dCv2ZdCkY0qCMhbqU1FXB8Pdv4mOdNVdXKMY2xRHask=; b=tKZGykaM69nLTkuZ5ky2jdtXUbQW+0Cp161f63URohw9iCJLSr7hkXmAZsEoim07Su hwS/y0T3UzFR7x7qlhYVEPod0r32dMo6k9GrqhFmjfoP3Cz1/3TeiDHIa9A5/QvWNyL2 ng8ZwKd4yCtSWL+VEvRoM2zafj+LxviUKEv/r/9dWmgmyVdTUBPaGkuGCm24Q6Zkr6yO 7ZJjEjjjxBf66iWB2QNgUbv6B9QOqzkj9gDLCpiI1VD/fZjgYnfUp0sTWBiOepAv677r zRDG9XYD+adLnHctgkMSJNlNeIV/VjRlUxoXzR2aiTH5nKU8MqPbxzOdQjF9vx5LWjAa H5Tg== X-Gm-Message-State: AOAM5318HXT5kkbkNwaz4qDTEcTaIaok6IINErdoChVb78pIaENGheK+ Wtb85tmjRwZl2VicenKlzKnfNJ7m+Yqweu6CSyBrDQ== X-Google-Smtp-Source: ABdhPJxZ4VLvkgQkfYrdQPEgUccy2Gxq4UWk/GGJdjdM3rE6rYi+Thc9+WMOfS0GZAYv4rW6bvgBCMU2bphOkyRNkG4= X-Received: by 2002:a50:d785:: with SMTP id w5mr12551406edi.212.1589800378320; Mon, 18 May 2020 04:12:58 -0700 (PDT) MIME-Version: 1.0 References: <000000000000b4684e05a2968ca6@google.com> <86c504b3-52c9-55f6-13db-ab55b2f6980e@oracle.com> In-Reply-To: <86c504b3-52c9-55f6-13db-ab55b2f6980e@oracle.com> From: Miklos Szeredi Date: Mon, 18 May 2020 13:12:47 +0200 Message-ID: Subject: Re: kernel BUG at mm/hugetlb.c:LINE! To: Mike Kravetz Cc: syzbot , Andrew Morton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Miklos Szeredi , syzkaller-bugs , Al Viro Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, May 16, 2020 at 12:15 AM Mike Kravetz wrote: > I started going down the path of creating a get_unmapped_area f_op for > overlayfs. That is pretty straight forward and works well. But that > did not take care of the is_file_hugepages() routine. Recall that > is_file_hugepages simply does if (file->f_op == &hugetlbfs_file_operations). > > I suppose I could add a specific overlayfs check like real_file here. But, > that does not seem like a clean solution. > > I also discovered other routines doing comparisons like > if (file->f_op == ), they are: > is_dma_buf_file() > is_file_shm_hugepages() > get_pipe_info() > is_file_epoll() > > So, it seems that these routines are also impacted if operating on files > in an overlayfs? Those are non-filesystems, with the exception of is_file_shm_hugepages(), the only caller of which is is_file_hugepages(). > Any suggestions on how to move forward? It seems like there may be the > need for a real_file() routine? I see a d_real dentry_op was added to > deal with this issue for dentries. Might we need something similiar for > files (f_real)? > > Looking for suggestions as I do not normally work with this code. And I'm not so familiar with hugepages code. I'd suggest moving length alignment into f_op->get_unmapped_area() and cleaning up other special casing of hugetlb mappings, but it's probably far from trivial... So yeah, that leaves a real_file() helper or something similar. Unlike the example I gave first it actually needs to be recursive: static inline struct file *real_file(struct file *file) { whole (unlikely(file->f_op == ovl_file_operations)) file = file->private_data; return file; } Thanks, Miklos