linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: "Dorau, Lukasz" <lukasz.dorau@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: nfit_test: issue #3: BUG: kernel NULL pointer dereference, address: 0000000000000018
Date: Tue, 17 Mar 2020 01:26:08 -0700	[thread overview]
Message-ID: <CAPcyv4iAJbZpKYzA5SgGcH+dkPQyHkxgGgufTd_YnSZ5bF_X7A@mail.gmail.com> (raw)
In-Reply-To: <SN6PR11MB28647B2D8B3C0729FE0CCDD696F90@SN6PR11MB2864.namprd11.prod.outlook.com>

On Mon, Mar 16, 2020 at 1:58 AM Dorau, Lukasz <lukasz.dorau@intel.com> wrote:
>
> On Friday, March 13, 2020 4:50 PM Dan Williams <dan.j.williams@intel.com> wrote:
> > On Fri, Mar 13, 2020 at 3:06 AM Dorau, Lukasz <lukasz.dorau@intel.com> wrote:
> > >
> > > The steps to reproduce:
> > >
> > > $ sudo modprobe -v nfit_test
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/kernel/drivers/char/hw_random/rng-core.ko.xz
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/kernel/drivers/char/tpm/tpm.ko.xz
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/kernel/security/keys/trusted-keys/trusted.ko.xz
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/kernel/security/keys/encrypted-keys/encrypted-keys.ko.xz
> > > install /usr/bin/ndctl load-keys ; /sbin/modprobe --ignore-install libnvdimm
> > $CMDLINE_OPTS
> > > No TPM handle discovered.
> > > failed to open file /etc/ndctl/keys/nvdimm-master.blob: No such file or directory
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/kernel/drivers/nvdimm/libnvdimm.ko.xz
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/kernel/drivers/acpi/nfit/nfit.ko.xz
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/test/nfit_test_iomap.ko.xz
> > > insmod /lib/modules/5.6.0-rc1-13504-g7b27a8622f80/extra/test/nfit_test.ko.xz
> > > modprobe: ERROR: could not insert 'nfit_test': Unknown symbol in module, or
> > unknown parameter (see dmesg)
> > >
> > > $ dmesg | tail
> > > [  102.769871] Key type encrypted registered
> > > [  102.799289] nfit_test_iomap: loading out-of-tree module taints kernel.
> > > [  102.804008] nfit_test: Unknown symbol libnvdimm_test (err -2)
> > > [  102.804054] nfit_test: Unknown symbol acpi_nfit_test (err -2)
> > > [  102.804118] nfit_test: Unknown symbol pmem_test (err -2)
> > > [  102.804164] nfit_test: Unknown symbol dax_pmem_core_test (err -2)
> > > [  102.804226] nfit_test: Unknown symbol dax_pmem_compat_test (err -2)
> > > [  102.804273] nfit_test: Unknown symbol device_dax_test (err -2)
> > > [  102.804308] nfit_test: Unknown symbol dax_pmem_test (err -2)
> > >
> > > Removing the wrong modules:
> > >
> > > $ sudo rmmod nfit
> > > $ sudo rmmod libnvdimm
> > >
> > > Inserting the right modules manually:
> > >
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/libnvdimm.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-g7b27a8622f80/extra/nd_btt.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/nd_pmem.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-g7b27a8622f80/extra/nfit.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/dax_pmem_core.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/dax_pmem.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/device_dax.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/dax_pmem_compat.ko.xz
> > > $ sudo insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/extra/test/nfit_test.ko.xz
> > >
> > > The 'nfit_test' module is successfully inserted with *NO ERRORS* now:
> > >
> > > $ dmesg | tail
> > > [  464.439504] nfit_test: mcsafe_test: disabled, skip.
> > > [  464.500439] nfit_test nfit_test.0: failed to evaluate _FIT
> > > [  464.507964] nfit_test nfit_test.1: Error found in NVDIMM nmem4 flags: save_fail
> > restore_fail flush_fail not_armed
> > > [  464.507990] nfit_test nfit_test.1: Error found in NVDIMM nmem5 flags: map_fail
> > > [  464.508614] nd_pmem namespace6.0: region6 read-only, marking pmem6 read-
> > only
> > > [  464.508729] pmem6: detected capacity change from 0 to 33554432
> > > [  464.508737] pmem7: detected capacity change from 0 to 4194304
> > >
> > > $ lsmod | grep nfit
> > > nfit_test              49152  8
> > > dax_pmem_compat        20480  1 nfit_test
> > > device_dax             20480  2 nfit_test,dax_pmem_compat
> > > dax_pmem               20480  1 nfit_test
> > > dax_pmem_core          20480  3 dax_pmem,nfit_test,dax_pmem_compat
> > > nfit                   73728  1 nfit_test
> > > nd_pmem                24576  1 nfit_test
> > > libnvdimm             200704  8
> > dax_pmem,nfit_test,dax_pmem_core,nd_btt,nd_pmem,dax_pmem_compat,nd_blk,
> > nfit
> > > nfit_test_iomap        24576  6
> > nfit_test,dax_pmem_core,device_dax,nd_pmem,libnvdimm,nfit
> > >
> > > Trying to remove and reinsert the 'nfit_test' module:
> > >
> > > $ sudo ndctl disable-region all
> > > disabled 8 regions
> > >
> > > $ sudo modprobe -v -r nfit_test
> > > rmmod nfit_test
> > > rmmod nfit
> > >
> > > $ sudo modprobe -v nfit_test
> > > insmod /lib/modules/5.6.0-rc1-13504-
> > g7b27a8622f80/kernel/drivers/acpi/nfit/nfit.ko.xz
> > > insmod /lib/modules/5.6.0-rc1-13504-g7b27a8622f80/extra/test/nfit_test.ko.xz
> > > modprobe: ERROR: could not insert 'nfit_test': Unknown symbol in module, or
> > unknown parameter (see dmesg)
> > >
> > > $ dmesg | tail
> > > [  919.861636] nfit_test: Unknown symbol acpi_nfit_test (err -2)
> >
> > I'm still not sure how you are managing to hit "unknown symbol"
> > errors, are you re-running depmod after creating the test modules?
>
> The above error:
>    "nfit_test: Unknown symbol acpi_nfit_test (err -2)"
> I have hit after having removed the 'nfit_test' module:
>    $ sudo modprobe -v -r nfit_test
> and having tried to reinsert it:
>
> $ sudo modprobe -v nfit_test
> insmod /lib/modules/5.6.0-rc1-13504-g7b27a8622f80/kernel/drivers/acpi/nfit/nfit.ko.xz
> insmod /lib/modules/5.6.0-rc1-13504-g7b27a8622f80/extra/test/nfit_test.ko.xz
> modprobe: ERROR: could not insert 'nfit_test': Unknown symbol in module, or unknown parameter (see dmesg)
>
> because 'modprobe' has inserted the production version of the 'nfit' driver (kernel/drivers/acpi/nfit/nfit.ko.xz)
> instead of the test one (extra/nfit.ko.xz).

Right, that's broken, but I'm not sure why.

>
> Regarding 'depmod' I have run the following commands to build and install the kernel and the modules:
> $ make
> $ make M=tools/testing/nvdimm
> $ sudo make M=tools/testing/nvdimm  modules_install     # ---> it runs depmod
> $ sudo make modules_install     # ---> it runs depmod
> $ sudo make install

What distro? On Fedora rawhide I'm doing the same steps and end up with:

# cat /lib/modules/$(uname -r)/modules.dep | grep nfit_test.ko
extra/test/nfit_test.ko: extra/dax_pmem.ko extra/dax_pmem_core.ko
extra/device_dax.ko extra/nd_pmem.ko extra/nd_btt.ko extra/nfit.ko
extra/libnvdimm.ko
kernel/security/keys/encrypted-keys/encrypted-keys.ko
kernel/security/keys/trusted-keys/trusted.ko
extra/test/nfit_test_iomap.ko kernel/drivers/char/tpm/tpm.ko

...i.e. the test version "extra/nfit.ko" in the dependency chain.
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

  reply	other threads:[~2020-03-17  8:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 14:59 nfit_test: issue #3: BUG: kernel NULL pointer dereference, address: 0000000000000018 Dorau, Lukasz
2020-03-12 15:06 ` Dorau, Lukasz
2020-03-12 17:08   ` Dan Williams
2020-03-13 10:06     ` Dorau, Lukasz
2020-03-13 15:49       ` Dan Williams
2020-03-16  8:58         ` Dorau, Lukasz
2020-03-17  8:26           ` Dan Williams [this message]
2020-03-17  9:09             ` Dorau, Lukasz
2020-03-17 16:14               ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPcyv4iAJbZpKYzA5SgGcH+dkPQyHkxgGgufTd_YnSZ5bF_X7A@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=lukasz.dorau@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).