Invalid zfs send via libzfs leads to kernel panic

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

Problem/Justification

None

Impact

None

SmartDraw Connector

Katalon Manual Tests (BETA)

Activity

Show:

Ryan Moeller 
September 15, 2020 at 4:43 PM

Ryan Moeller 
August 26, 2020 at 10:41 PM

Complete

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

More fields

Katalon Platform

Created June 11, 2020 at 8:39 PM
Updated July 1, 2022 at 3:30 PM
Resolved October 5, 2020 at 4:40 PM