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=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, 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 B1F32C2BB86 for ; Sun, 12 Apr 2020 21:42:02 +0000 (UTC) Received: from vger.kernel.org (unknown [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76790206C3 for ; Sun, 12 Apr 2020 21:42:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Csj+WSbQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76790206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728352AbgDLVmA (ORCPT ); Sun, 12 Apr 2020 17:42:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:50302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727388AbgDLVmA (ORCPT ); Sun, 12 Apr 2020 17:42:00 -0400 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5662EC0A88B7 for ; Sun, 12 Apr 2020 14:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586727719; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cZgZS3VL9u0IfZZxKaJedf/PTKndLbqxtt6EqiRUq98=; b=Csj+WSbQRiNSZFMZYrdYh08sUHrUTjaS8W8HqaiwJDSyhhWoW1vRpG2f2sH67tj1X1NtTz Pdt+vADwGxXtNe7+q4kub2Qv3mBZ/WVvwxwCYpOHcglgcr1FeM1F1i/oDegy0palWluEsL bzVU+RBhsie/hGocB+/24XxluJ+bU08= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-468-I_EpEg8lPRK337sVw_AYUA-1; Sun, 12 Apr 2020 17:41:55 -0400 X-MC-Unique: I_EpEg8lPRK337sVw_AYUA-1 Received: by mail-qt1-f199.google.com with SMTP id q43so5945396qtj.11 for ; Sun, 12 Apr 2020 14:41:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cZgZS3VL9u0IfZZxKaJedf/PTKndLbqxtt6EqiRUq98=; b=nR+Tn6pfRS5/0pnrFJh4qATLAcsYq5GlBnvWierwAt1kmAMz08N9Hg+yITRLbDFvx8 MILsDWwMyOeQlARi7kPBP4tVYH4ASG/QhvjiB5dQdejBezSgyEy+QvneplCssdDLRV1/ rlkz9dLrDaI/+6JDZyuZ2oOOEoov5khcUev997CQH/x+MHfadd8X8KOnSWnfjzPr1KfH G6qdunZJWBCEs6xLUSDc6YYqG3NfKZXIKa9h+42VRs0P2m/YbnW+AkR6fapzXi2IoKOC 8zRvVinD1HngXKIK7DgWUhPojTsRVvRnKBUyHCUuEl6QYlcvHF77zdZ0sNgUvcBl0+9D kapw== X-Gm-Message-State: AGi0Pub8DOOY9zdCmfOg4Jh1qGGHSJV8JWAGSTY4rumOCWC0LOMMg2ue nfvtC1AMwU5G1NMQxZHm+qNdx4H08BSM9/0j5a8qUt4faanUalMwP6DKTSgbL5WhqKOu3+5hySE EzIHWzFx5pnjwN/9v6sD3PQJe X-Received: by 2002:ac8:7408:: with SMTP id p8mr8849251qtq.82.1586727714583; Sun, 12 Apr 2020 14:41:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLYhh5/2KJDBWWaSqKpz9rNtf6twGnt8bcq4F1iR6WS2PijfIjU2a+iOx4m4OwZ4jGuWFBpvg== X-Received: by 2002:ac8:7408:: with SMTP id p8mr8849243qtq.82.1586727714223; Sun, 12 Apr 2020 14:41:54 -0700 (PDT) Received: from xz-x1 ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id j92sm1505197qtd.58.2020.04.12.14.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2020 14:41:53 -0700 (PDT) Date: Sun, 12 Apr 2020 17:41:50 -0400 From: Peter Xu To: Naresh Kamboju Cc: open list , "open list:KERNEL SELFTEST FRAMEWORK" , linux-mm , lkft-triage@lists.linaro.org, Shuah Khan , Anders Roxell , Christophe Leroy , Andrew Morton , Leonardo Bras , Michael Ellerman , Mike Rapoport , Arnd Bergmann , Jules Irenge , "Huang, Ying" , Pankaj Gupta , Rik van Riel , Hugh Dickins , Minchan Kim , Mel Gorman , Dave Hansen , Mateusz Nosek , Sebastian Andrzej Siewior , Kees Cook , Vlastimil Babka , Hillf Danton Subject: Re: i386: selftests: vm: compaction_test: BUG: kernel NULL pointer dereference, address: 00000000 Message-ID: <20200412214150.GB38470@xz-x1> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Naresh, On Sun, Apr 12, 2020 at 12:24:57PM +0530, Naresh Kamboju wrote: > On Linux mainline kernel 5.6.0 running kselftest vm compaction_test on i386 > kernel running on x86_64 devices we have noticed this Kernel BUG followed by > Kernel panic. > > BUG: kernel NULL pointer dereference, address: 00000000 > Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 > > Steps to reproduce: > -------------------------- > # cd /opt/kselftests/default-in-kernel/vm/ > # ./compaction_test > > [ 45.955706] kauditd_printk_skb: 15 callbacks suppressed > [ 45.955707] audit: type=1334 audit(1586671685.974:25): prog-id=13 op=UNLOAD > [ 45.968082] audit: type=1334 audit(1586671685.974:26): prog-id=12 op=UNLOAD > [ 46.008163] get_swap_device: Bad swap file entry 7007504a > [ 46.013647] BUG: kernel NULL pointer dereference, address: 00000000 I suspect this is the same issue with: https://lore.kernel.org/lkml/20200410002518.GG8179@shao2-debian/ And since this one is very easy to reproduce, I finally noticed that we have wrongly enabled uffd-wp on x86_32, which is definely not going to work... Because we'll use bit 2 of swap entry assuming that's the uffd-wp bit, while that's part of swp offset on 32bit systems. Naresh, could you try whether below change fixes the issue for you? diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 8d078642b4be..7ac524d1316e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -149,7 +149,7 @@ config X86 select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64 - select HAVE_ARCH_USERFAULTFD_WP if USERFAULTFD + select HAVE_ARCH_USERFAULTFD_WP if X86_64 && USERFAULTFD select HAVE_ARCH_VMAP_STACK if X86_64 select HAVE_ARCH_WITHIN_STACK_FRAMES select HAVE_ASM_MODVERSIONS Thanks, -- Peter Xu