Uploaded image for project: 'FreeNAS / TrueNAS'
  1. FreeNAS / TrueNAS
  2. NAS-106452

Invalid zfs send via libzfs leads to kernel panic

    XMLWordPrintable

    Details

    • Type: Defect
    • Status: Done (View Workflow)
    • Priority: Low
    • Resolution: Complete
    • Affects Version/s: 12.0-RC1
    • Fix Version/s: 12.0-RELEASE
    • Component/s: ZFS
    • Labels:
      None

      JEditor

        Description

        12.0 nightly

        Prepare:

        zfs create data/src
        zfs snapshot data/src@data/src@2018-10-01_03-00
        zfs snapshot data/src@data/src@2018-10-01_02-00
        zfs send data/src@2018-10-01_03-00 | zfs recv -F data/dst

        (03-00 goes before 02-00 intentionally)

        Attempt incorrect zfs send:

        truenas# zfs send -i data/src@2018-10-01_02-00 data/src@2018-10-01_03-00 | zfs recv -F data/dst
        warning: cannot send 'data/src@2018-10-01_03-00': not an earlier snapshot from the same fs
        cannot receive: failed to read from stream

        That's what is expected. Now let's try to do the same using libzfs.

        1.py:
        import socket
        import libzfs
        s = socket.socket()
        s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        s.bind(("127.0.0.1", 1024))
        s.listen()
        client, addr = s.accept()
        fh = client.fileno()
        zfs = libzfs.ZFS()
        zfs.receive("data/dst", fh, force=True, resumable=True)

        2.py:
        import socket
        import libzfs
        s = socket.socket()
        s.connect(("127.0.0.1", 1024))
        fh = s.fileno()
        zfs = libzfs.ZFS()
        zfs.get_object("data/src").send(fh, fromname="2018-10-01_02-00", toname="2018-10-01_03-00")

        Run python 1.py &, then python 2.py, you'll get a kernel panic. It works ok in 11.3

          Attachments

          1. 1.py
            0.3 kB
          2. 2.py
            0.2 kB

            Attachments

              Activity

                People

                Assignee:
                ryan Ryan Moeller
                Reporter:
                themylogin Vladimir Vinogradenko
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: