From nobody Thu Oct 27 17:13:05 2022 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 4Mysh14TyMz4gXhj for ; Thu, 27 Oct 2022 17:13:05 +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 4Mysh12YT6z3wTj for ; Thu, 27 Oct 2022 17:13:05 +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 4Mysh11KDYz15d8 for ; Thu, 27 Oct 2022 17:13:05 +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 29RHD5iZ048767 for ; Thu, 27 Oct 2022 17:13:05 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 29RHD5wt048766 for bugs@FreeBSD.org; Thu, 27 Oct 2022 17:13:05 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 267396] le_advertizing_report() calls NG_HCI_M_PULLUP() without checking for failure Date: Thu, 27 Oct 2022 17:13:05 +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=1666890785; 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=L+2Hc/m3ZXnvKO5EdFU76PJCVfXVsjELGKkED2pF6Wk=; b=r45tHOuj0yI0U0BACkYM3MQ2z5tVeDuy1JbbhBT7uS1B8TNf4xbTnoTz0j/TgwSqvypGgR YUJElkoXgQu2mT8y/sDNParjqtIUmssb88lE/g5MgWyoYf6rcEbVoutEQe+JBR83nPeXUl 7bMEINfXEMbB+sdVYyzt+9eyihbIG+WRu6wP5+QiCCmUrhGiawTtNiMWN9OnNPTfKqWv7B sAXcxunhF8uNZHmSpuSzHzTYjUSepvqulMwa0mTAXHu53s29idigtC2BUEyt8ZDDUbMn1h TixTL0LmmUJGPoqbGLv9GkHGNum1J/7hdzn++798I2IV9XK7oRNhp8mI2vifoQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666890785; a=rsa-sha256; cv=none; b=IrJqPoknve8P1HZhduL0l0P/v2KHteXdBCJCr9pbLl9C9gTjoPrXo7B9/AfnCmSJW091UR mVwKMXYseGtzSG2TbEXhMa/av17RRhqDkv1ow2tGf3gevKzkbW3nyXBa/tzz60Skdm0p8q adrjyahHT+7hJ7mI1/oeNSucxXlv5oGYeR6ltOxwoUfRVXcarTJ6fTDctwLpUEPzEIOHhA 4BlNW1Mh+qtS/T0QP1NcFBizRCg7c61Qkk5NjyTuZHqxcw6GNxXI+ebJ/4NAaF/8ql6Xcv a7di2Flr5jGv//UeyYA3O6TTS9E4eHs+YQPTiprvzH2nSVvbl+bRaBYS5DidaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267396 Bug ID: 267396 Summary: le_advertizing_report() calls NG_HCI_M_PULLUP() without checking for failure 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 #237685 text/plain mime type: Created attachment 237685 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D237685&action= =3Dedit cause a NULL dereference in le_advertizing_report() le_advertizing_report() calls NG_HCI_M_PULLUP() without checking for failure, and it also calls m_copydata() without first checking the length: /* Get remote unit address */ NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); addr_type =3D *mtod(event, u_int8_t *); m_adj(event, sizeof(u_int8_t)); m_copydata(event, 0, sizeof(bdaddr), (caddr_t) &bdaddr); m_adj(event, sizeof(bdaddr)); I've attached a demo that causes a crash due to the pullup leaving event set to NULL: # cc ng36a.c -lnetgraph # ./a.out le_advertizing_report: hci0 - m_pullup(1) failed panic: Fatal page fault at 0xffffffc00040d8f0: 0x00000000000010 panic() at panic+0x2a page_fault_handler() at page_fault_handler+0x1d6 do_trap_supervisor() at do_trap_supervisor+0x74 cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x70 --- exception 13, tval =3D 0x10 le_advertizing_report() at le_advertizing_report+0xcc le_event() at le_event+0x9a ng_hci_process_event() at ng_hci_process_event+0x206 ng_hci_drv_rcvdata() at ng_hci_drv_rcvdata+0xb8 ng_apply_item() at ng_apply_item+0x130 ng_snd_item() at ng_snd_item+0x1bc ngd_send() at ngd_send+0xf8 sosend_generic() at sosend_generic+0x384 sosend() at sosend+0x68 kern_sendit() at kern_sendit+0x170 sendit() at sendit+0x9c sys_sendto() at sys_sendto+0x40 syscallenter() at syscallenter+0xec ecall_handler() at ecall_handler+0x18 do_trap_user() at do_trap_user+0xf6 cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --=20 You are receiving this mail because: You are the assignee for the bug.=