From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795905759; b=bMWcZkIBx0OCpKG3IqHzvy30hhff7CzWKgoHwLYjmvRUQltT8JYDoyEY2aRQo95j9mmz 54CBfYan7IL8UB8qXTzHqtF4m88iYO3jhhbKYL6Ge/kUs/zu5PnXUTLGaoUa3fBsr/Bdp aEoWQStqYa5qX+4nmquyEYOgmQZ5cK80HcnOHEPo12ZtQutO8j9IOTlB2nVmQYm3Opnfc /QoUIUx+36ItTrrVPHZxOMS1LL362UF6B7O+CCuZ+esGsypBQhYE2RUIuSdrbEu9SPZuO 6Z5nJqap2VE4WSiOMHZ6iJLL0UBSogFewIuDnPKp04noxhNmDC6lE+pSlmJhY8b4Gog== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795905759; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=oddDLw0I+0bddvSQgsTIBmTAqp3WDlMNO7KNRDrNwOI=; b=jzD6xNkvD2l/mtb8BWqCzcVGb1v3RKFeZMcg9NYOob4JkF6O8RcvvyMVMSCQ80F7p/aO xhzZ/xKLsPRG/TivuTMOIo6zwMVsgRiNOCP9XfcztHaDtLpn0rCQnAMX2S3GojVTJIK9d 1ObDWLo0vzXZ6arQKCLYLnAXPBjQcSjNRprvJXlXJqchY0fMWE6bTAeLY0tfNLzAa2r5r m+A82IisDMl/CtLmL1PnfBRve0MpbFBd/sLvjf8Vpm9rBcbzHa1cDMQoOQ4XG6yMfFNt/ Pj+zQoLuSwz400Av5nEpL5BjMWlzObGXUVT/iRZJm+DfK/02e43xTtdcGOZMGP2hUAQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=d1Hlipv6; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43B0B606A31C for ; Sat, 28 Nov 2026 22:42:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=d1Hlipv6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 325211F00897; Sat, 28 Nov 2026 22:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795905758; bh=oddDLw0I+0bddvSQgsTIBmTAqp3WDlMNO7KNRDrNwOI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=d1Hlipv69okyLF1K7VkARfxWTOIGvhkmQnGDQiBxdh/JkEk9KloIPsLdVDk7FnTKC 3h1s0+N1Joos3lss9P3Di9NjMkRIAneu2aR6YOlJ2j4Lc5MH0yr+t3p70UHyd6Oovl 9ANVE0t2LcWUIthRrOV0HjlEMEHx6qy6zf1nzIdiHQ4pWoJUHTQxKwIFtapf+km9en hWPmX56P2frjnz/lVesd9Q2qtZoXSxMCO4MSzYPFjKl60rdHK3JepzsUxGzSRXqGpO nOadK0ZilmETKmF5GJHfxwAByY89gjxi5o1d/ecJuJwWbMewVVPpxxArVEwXoAg2p+ Ye0hQxjhAONqA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 17/17] arm64: dts: apple: t6031: add avd nodes Reply-To: sashiko-reviews@lists.linux.dev To: "Sofus Forstreuter" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org In-Reply-To: <20261128-avd-v4-17-35ad7d52c842@icloud.com> References: <20261128-avd-v4-0-35ad7d52c842@icloud.com> <20261128-avd-v4-17-35ad7d52c842@icloud.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Nov 2026 22:42:37 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Critical] media: apple: avd: out-of-bounds access in compute_tile_ids() on HEVC controls - [High] media: apple: avd: missing dimension checks in avd_av1_set_prob() and calc_upscale() - [Low] arm64: dts: apple: undocumented apple,t6031-dart compatible in iommu@2cd010000 - [Low] arm64: dts: apple: unpermitted dma-coherent property on video-codec@2cd070000 -- commit 3f6c99ab9326c07d26df77a52366b9ba23343102 Author: Sofus Forstreuter arm64: dts: apple: t6031: add avd nodes This commit adds the Apple Video Decoder (AVD) and its corresponding DART IOMMU nodes to the T6031 per-die devicetree include file. > diff --git a/arch/arm64/boot/dts/apple/t6031-dieX.dtsi b/arch/arm64/boot/= dts/apple/t6031-dieX.dtsi > index 1624651c1d92c..4fc6d1575b761 100644 > --- a/arch/arm64/boot/dts/apple/t6031-dieX.dtsi > +++ b/arch/arm64/boot/dts/apple/t6031-dieX.dtsi > @@ -101,6 +101,39 @@ DIE_NODE(pinctrl_ap): pinctrl@2b3000000 { > apple,npins =3D <200>; > }; > =20 > + DIE_NODE(avd_dart): iommu@2cd010000 { > + compatible =3D "apple,t6031-dart", "apple,t8110-dart"; [Severity: Low] Does apple,t6031-dart need to be documented in Documentation/devicetree/bindings/iommu/apple,dart.yaml first? Without an entry in the binding schema, dtbs_check fails on T6031, T6032, and T6034 device trees. > + reg =3D <0x2 0xcd010000 0x0 0x4000>; > + interrupt-parent =3D <&aic>; > + interrupts =3D ; > + #iommu-cells =3D <1>; > + power-domains =3D <&DIE_NODE(ps_avd_sys)>; > + }; > + > + video-codec@2cd070000 { > + compatible =3D "apple,t6031-avd", "apple,t8122-avd"; [Severity: Critical] Can enabling the AVD driver on T6031 allow unprivileged userspace with access to /dev/video* to trigger heap out-of-bounds reads and writes in compute_tile_ids() via crafted V4L2_CID_STATELESS_HEVC_SPS and V4L2_CID_STATELESS_HEVC_PPS controls? drivers/media/platform/apple/avd/avd-hevc.c:compute_tiles_non_uniform() { for (i =3D 0; i < num_cols - 1; i++) { column_width[i] =3D pps->column_width_minus1[i] + 1; sum +=3D column_width[i]; } column_width[i] =3D pic_in_cts_width - sum; for (i =3D 0, sum =3D 0; i < num_rows - 1; i++) { row_height[i] =3D pps->row_height_minus1[i] + 1; sum +=3D row_height[i]; } row_height[i] =3D pic_in_cts_height - sum; } When sum >=3D pic_in_cts_width or sum >=3D pic_in_cts_height, subtracting s= um underflows u16 column_width[i] or row_height[i] to up to 65535. compute_bd() then produces col_bd and row_bd entries far exceeding the picture CTB dimensions, causing compute_tile_ids() to index y * pic_in_ctbs_width + x past the end of the heap arrays ctb_addr_rs_to_ts and tile_ids (allocated with pic_in_ctbs_size elements in avd_hevc_compute_tiles()). In addition, avd_hevc_validate_sps() does not reject zero sps->pic_width_in_luma_samples or sps->pic_height_in_luma_samples (which makes pic_in_ctbs_size =3D=3D 0 so kzalloc_objs() returns ZERO_SIZE_PTR for ctb_addr_rs_to_ts and tile_ids), nor does it bound sps->log2_min_luma_coding_block_size_minus3 + 3 + sps->log2_diff_max_min_luma_coding_block_size before avd_hevc_compute_tiles() shifts and divides by max_cu_width. [Severity: High] Does enabling the AVD driver also expose an out-of-bounds kernel memory write in avd_av1_set_prob() and a division by zero in calc_upscale() when userspace submits crafted V4L2_CID_STATELESS_AV1_FRAME or V4L2_CID_STATELESS_H264_SPS controls? drivers/media/platform/apple/avd/avd-av1.c:avd_av1_set_prob() { ... memcpy(vaddr + AVD_AV1_CDFS_OFFSET(length, dst->av1.color_size), av1_ctx->bufs.probs.cpu, sizeof(struct avd_av1_cdfs)); } Neither avd_av1_try_ctrl() nor avd_av1_run_preamble() validates frame->frame_width_minus_1 + 1 and frame->frame_height_minus_1 + 1 against ctx->decoded_fmt.fmt.pix_mp.width and height. When the frame dimensions exceed the capture buffer format dimensions, update_dec_buf_info() computes dst->av1.color_size larger than the plane length, so AVD_AV1_CDFS_OFFSET(length, dst->av1.color_size) underflows and avd_av1_set_prob() writes sizeof(struct avd_av1_cdfs) bytes before vaddr (or wraps width/height to 0 in set_refs() when frame_width_minus_1 =3D=3D U32_MAX, dividing by zero). Furthermore, set_header() calls calc_upscale() without checking that frame->upscaled_width is non-zero, dividing by upscaled_plane_w =3D=3D 0 wh= en frame->upscaled_width =3D=3D 0. Similarly, avd_h264_validate_sps() does not validate (sps->pic_width_in_mbs_minus1 + 1) * 16 and (sps->pic_height_in_map_units_minus1 + 1) * 16 against the allocated format dimensions before stream_hdr() programs the hardware with the SPS dimensions. > + reg =3D <0x2 0xcd070000 0x0 0x4000>, > + <0x2 0xcd080000 0x0 0x10000>, > + <0x2 0xcd090000 0x0 0x14000>, > + <0x2 0xcd0a4000 0x0 0x4000>, > + <0x2 0xcd100000 0x0 0x10000>; > + reg-names =3D "piodma", "code", "sram", "mbox", "ctrl"; > + interrupt-parent =3D <&aic>; > + interrupts =3D , > + , > + , > + , > + , > + , > + ; > + interrupt-names =3D "mbox0", "mbox1", "mbox2", "mbox3", > + "flag0", "flag1", "piodma"; > + iommus =3D <&DIE_NODE(avd_dart) 0>, <&DIE_NODE(avd_dart) 1>; > + power-domains =3D <&DIE_NODE(ps_avd_sys)>; > + resets =3D <&DIE_NODE(ps_avd_sys)>; > + dma-coherent; > + }; [Severity: Low] Is dma-coherent allowed by Documentation/devicetree/bindings/media/apple,avd.yaml? That binding sets additionalProperties: false without listing dma-coherent, which causes dtbs_check to fail on video-codec@2cd070000. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261128-avd-v4-0-3= 5ad7d52c842@icloud.com?part=3D17