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=1795905366; b=hZ1dSX6SpvZcJtnjvaX5vekBbORmRDEHwS4W8myThUwIR10gOeio4tpyrHDcP4DOYmMk l4ITZbxTN6CWvd8Rq5hnZHokEcjz7pZa93p4u6d8RMbwj/mWG1BSen/APPavrsvGLaUN2 MY6D1/glNxFSCvehwvj9Sm0mM+OI11BGfaBY+pjModt9vPpXT4GdwW79mllFDw5fufo51 XWYIZwDt3DAA2DZK0wBSFi7Dh9OJ7hiXvlMh48uFQUUBVlNxuV/VTga+/Hjtwm60fhWl5 TGS7KjLvVLj9OCFR+rEKzWn+AcLUOp8LRnqpzYefhNT/N47X1J/j3+1mKkkv2082SYg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795905366; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ZzSpDQs5mr7ZfK4Jm7/eGkN4uDEMnXXA7wkyBGVbCn8=; b=y+CIsJSOI41s7mHB1i1iT1MepuTd1QFOntkXUQRuaP1E/vKCFt1cA4pkpVCs7rTJdw1E nfjyefcgMOw23akmXRwyIF/ZwFJx3lcySGRN+LZN2nlVZB5ercfC7JhQlEisOD5ZY+iG8 cw4OXa1Uk4Bm6AUaseQifwrriuN4MDsgpgknXZWai3G8LP2Fc/9W4yyYEcVRImIKCyGps 2KDYLRFvBiuik5jJJ64degA0iEaPVYc6Wasz5u+Xge/RN6YONPvp7DfyymI262sDdwqRl 2yWHRpONI+MuRG5fAvY6T3tj4ov1YhKVbD36L/bWJkJ3BJLDKQJ+t579Q92m9LrlMSw== 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=Feaf2t7W; 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 B5CB6606A31C for ; Sat, 28 Nov 2026 22:36:06 +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=Feaf2t7W Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E2201F000C1; Sat, 28 Nov 2026 22:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795905366; bh=ZzSpDQs5mr7ZfK4Jm7/eGkN4uDEMnXXA7wkyBGVbCn8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Feaf2t7WtkWO71cpzswoZ+3cSeVs21Kytb8XX2e/C+nrQaHlp8QF1GfRadiUt3aNZ NFKhCTnuam57xoECTwzRmCYZO9YEQt57q1iCnnyslP1ETASwYZzf5XYE0vRsF6FLjd zMbkrBoKOz6j8ziCU2C+jUlpt055jCm4LjKoTYxOYE2UCzt397YPW2uCR38uOND+sm g7Q4WR2VEUUm2wp/GOTRQEFlG7Nwv8rW14l78dyS9mvX8CrNIXU/D+a8CM9MQQickX T2D6JT/cvLy10o1EpBtKUPIAekC0/x/kM0cElLUD/yW53bINGugB9ggNfuY1WWcOtX EgTwo3Z6awafQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 11/17] arm64: dts: apple: t8103: 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-11-35ad7d52c842@icloud.com> References: <20261128-avd-v4-0-35ad7d52c842@icloud.com> <20261128-avd-v4-11-35ad7d52c842@icloud.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Nov 2026 22:36:04 +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 heap accesses in compute_tile_ids() - [Critical] media: apple: avd: missing input validation and stale state in avd-av1.c - [Medium] arm64: dts: apple: t8103: undocumented dma-coherent on video-codec@269070000 - [Low] arm64: dts: apple: t8103: missing commit message description body -- commit a42482d760146079b998f04577af5da5b0a27753 Author: Sofus Forstreuter > arm64: dts: apple: t8103: add avd nodes > > Reviewed-by: Neal Gompa > Signed-off-by: Sofus Forstreuter [Severity: Low] This commit message has no changelog body describing the added avd_dart DART IOMMU and Apple Video Decoder nodes. > diff --git a/arch/arm64/boot/dts/apple/t8103.dtsi b/arch/arm64/boot/dts/a= pple/t8103.dtsi > index 5b68bf0df4e6b..a37f135af616d 100644 > --- a/arch/arm64/boot/dts/apple/t8103.dtsi > +++ b/arch/arm64/boot/dts/apple/t8103.dtsi > @@ -984,6 +984,39 @@ pinctrl_aop: pinctrl@24a820000 { > ; > }; > =20 > + avd_dart: iommu@269010000 { > + compatible =3D "apple,t8103-dart"; > + reg =3D <0x2 0x69010000 0x0 0x4000>; > + interrupt-parent =3D <&aic>; > + interrupts =3D ; > + #iommu-cells =3D <1>; > + power-domains =3D <&ps_avd_sys>; > + }; > + > + video-codec@269070000 { > + compatible =3D "apple,t8103-avd"; > + reg =3D <0x2 0x69070000 0x0 0x4000>, > + <0x2 0x69080000 0x0 0xc000>, > + <0x2 0x6908c000 0x0 0xc000>, > + <0x2 0x69098000 0x0 0x4000>, > + <0x2 0x69100000 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 <&avd_dart 0>, <&avd_dart 1>; > + power-domains =3D <&ps_avd_sys>; > + resets =3D <&ps_avd_sys>; > + dma-coherent; > + }; [Severity: Medium] Does dma-coherent on video-codec@269070000 fail make dtbs_check? Documentation/devicetree/bindings/media/apple,avd.yaml sets additionalProperties: false and does not list dma-coherent under properties. [Severity: Critical] Can exposing video-codec@269070000 allow unprivileged userspace to trigger out-of-bounds kernel heap reads and writes in the HEVC decoder via compute_tile_ids()? When an HEVC decode request runs avd_device_run() -> avd_hevc_run() -> avd_hevc_compute_tiles(), compute_tiles_non_uniform() accumulates unvalidated pps->column_width_minus1[i] + 1 and pps->row_height_minus1[i] + 1 into sum and assigns the final u16 entry as pic_in_cts_width - sum and pic_in_cts_height - sum: 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; sum =3D 0; for (i =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, the subtracti= on underflows u16 and compute_bd() produces col_bd and row_bd entries exceeding pic_in_ctbs_width and pic_in_ctbs_height. compute_tile_ids() then reads ctb_addr_rs_to_ts and writes tile_ids out of bounds on the kernel heap. In addition, neither std_validate_compound() nor avd_hevc_validate_sps() rejects zero pic_width_in_luma_samples / pic_height_in_luma_samples or out-of-range log2_min_luma_coding_block_size_minus3 / log2_diff_max_min_luma_coding_block_size, so avd_hevc_compute_tiles() can hit an undefined shift or divide by zero when computing max_cu_width before avd_hevc_alloc_scratch() checks if (!max_cu_width), or allocate ZERO_SIZE_PTR for ctb_addr_rs_to_ts and tile_ids. [Severity: Critical] Can the AVD driver's AV1 decoder in drivers/media/platform/apple/avd/avd-av= 1.c write out of bounds in avd_av1_set_prob() when given unvalidated frame dimensions? Neither validate_av1_frame() nor avd-av1.c checks frame_width_minus_1 + 1 and frame_height_minus_1 + 1 against the CAPTURE buffer dimensions, so dst->av1.color_size can exceed dst->base.vb.vb2_buf.planes[0].length and underflow AVD_AV1_CDFS_OFFSET(), causing memcpy() in avd_av1_set_prob() to write sizeof(struct avd_av1_cdfs) bytes before vaddr: 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)); } In set_tiles(), assigning u32 tile_group->tile_row and tile_group->tile_col to signed int allows values >=3D 0x80000000 to become negative, bypass the V4L2_AV1_MAX_TILE_ROWS / V4L2_AV1_MAX_TILE_COLS upper-bound check, and index tile_info arrays out of bounds. In calc_upscale(), an unvalidated frame->upscaled_width of 0 yields upscaled_plane_w =3D=3D 0 and triggers an integer division by zero. Finally, set_refs() declares alpha, beta, gamma and delta outside the reference loop, so when avd_av1_dec_get_shear_params() returns early on mat[2] <=3D 0, the iteration reuses stale shear parameters from an earlier reference frame. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261128-avd-v4-0-3= 5ad7d52c842@icloud.com?part=3D11