From nobody Wed Dec 15 19:56:09 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4761A18EB7A6 for ; Wed, 15 Dec 2021 19:56:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JDmG15j62z3srP for ; Wed, 15 Dec 2021 19:56:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9940D22597 for ; Wed, 15 Dec 2021 19:56:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1BFJu9XS095595 for ; Wed, 15 Dec 2021 19:56:09 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1BFJu9nf095594 for bugs@FreeBSD.org; Wed, 15 Dec 2021 19:56:09 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 260449] incorrect PRIV_REQUEST() uses in iscsi target code Date: Wed, 15 Dec 2021 19:56:09 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639598169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QzfoyT40NzNgbSz3OPfXWR617zJt8zkMnL59nGTCCTI=; b=lzJynWZgqOiy7FP+VxfDpuVYt2+FlEsDlp62ZY+pr8LOswFKDg37jkGCJXD1Qwf/D8nXfZ DeBEw207pW1J7VPhzF14lADun7SC3FUKW2fuFB/VPWck4ZKgnm+HYf82gAVvxDxCR6dF4w awtEq8/TlTWxkSJiJHllVTfhYv+RSbIBAPHjgFT+fDpDXHa7YO4hgZxHNWwMI5/GlJjhNH JJYjlp1vgHMM+7uKbT7fYKFu86olOrmStr8I7qNe3ApFdlIBc12pw55ayhtUlfX9YA6FNV 3ukNETTGnbPHLMT5pkRMmOpSlYvF6Fj/w1aAcPuYogZFC3TPGxxHJnLgfwekDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639598169; a=rsa-sha256; cv=none; b=VtKsywf/oF6pABW6jofkEae9tzv2ppBKwGxdgn6SVnAfw7HEZONtyYFs7lJGtRvij1JSKT ecM4xxi9xaF2MXnYHmT7yEJUEBJTBZG5fZ3p2jJTlPoNufO2mvr/DdOfzi4csDSA8+wqin M2dgwT6TRtdT3iJzsR20SLiZ3c1KQwilkQxN9G+3a33LAanGnvgl3bHG7IjWiCXcSeKS2w YEeikslhlRPTufiRSyUqYcMf8cY+COp91JLvBohR0Ytd0Kz/AQBysxhPXh52UDi1M9MZWc d9SjSTxVRdcjHYCWhGXgNueQbtIlsGuBTq4+YHjbGCn7uzBVN7Gvjp1iPd00aQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260449 Bug ID: 260449 Summary: incorrect PRIV_REQUEST() uses in iscsi target code Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #230154 text/plain mime type: Created attachment 230154 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D230154&action= =3Dedit Cause iscsi target to crash due to incorrect PRIV_REQUEST() uses. I suspect this line in cfiscsi_done(): cs =3D PRIV_REQUEST(io); should be request =3D PRIV_REQUEST(io); cs =3D PDU_SESSION(request); And this line in cfiscsi_session_terminate_tasks() looks odd: PRIV_REQUEST(io) =3D cs; I'd expect ... =3D request, not ... =3D cs. I've attached a program that (on my machine) produces panic from the first problem, and (once the first is fixed) a kernel page fault due to the second. panic: refcount 0xffffffd0023eb7b4 wraparound panic() at panic+0x2a _refcount_update_saturated() at _refcount_update_saturated+0x16 refcount_releasen() at refcount_releasen+0x4c refcount_release() at refcount_release+0xc cfiscsi_done() at cfiscsi_done+0x3e ctl_process_done() at ctl_process_done+0x460 ctl_work_thread() at ctl_work_thread+0x13e fork_exit() at fork_exit+0x80 fork_trampoline() at fork_trampoline+0xa panic: Fatal page fault at 0xffffffc0000468c4: 0x000000000000ba --- exception 15, tval =3D 0xba cfiscsi_done() at cfiscsi_done+0x5e ctl_process_done() at ctl_process_done+0x460 ctl_work_thread() at ctl_work_thread+0x13e fork_exit() at fork_exit+0x80 fork_trampoline() at fork_trampoline+0xa FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #160 main-n250912-e4746deeda02-dirty: Wed Dec 15 14:36:14 EST 2021=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv --=20 You are receiving this mail because: You are the assignee for the bug.=