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=1796351877; b=NXDiO/M9zzh/LUT8h2mvj8YwWVtk0ARXhFsgYQ4yAA0EtjhbxkijSr8JdtbvV444o9no mr270/X4A4ntG0hO9a8DzieWNJV0e6HBds7YAv7z5/uNufvax/Tt4rhJfbUrbkR+zTBkS 3dMIPVreCgiysZb3n2+gVWgL2k6fB74gQE3+fVT6sq96WeHIp3IPqes+apgBKmpjDdxqt K6shFzzNpVz+mpe7ljaXoVa99U3wxDeA/6oOvlH2P/1sqGBjrKQN0hwpwCGeM3Rap8hci IzumW5JlR28ynGHYQ7BjO5jCw4R//Z3ShCVfryVcOWBs5QkdXvArhecQSijjWlXSRQQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796351877; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=XYBCIJWGQqipLhaYMSmWtyPmojaVr66Ilglkn9cXT4w=; b=Anry+IuBhZbxCJHyFC99mhwvk22CDWtXjSQEDJquSNsNVfdhunMh+hBFl1oXppJ4eER0 QoOcyY6ATg5YfI6gcl2Z33iQwCwn7cKLBnjcmU1FECLnkei5j24m30KJFMWpU6slePzzp G6mb6hnGZA0dCeZ6X8ImNg4YQ5ktfxESG8HRydkuYlpxL8CLR3cByeGBUGrmaZB4q1l8f 5A3Pg/WODtU3b0PHRZzLqyDP6Mwo+dm829zpq6wokdbcoPdKn62Y/QjKJJutiLB7gKcDj yb3RpAXYs8Xj/9TjNlJZ8l7Wag5cBrgLAw+noU3tTZqq80jbMOZBM5lgmp3LUrpaBig== 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=M68ODAdK; 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 E75FD606A32F for ; Fri, 4 Dec 2026 02:37:56 +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=M68ODAdK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C6291F000C2; Fri, 4 Dec 2026 02:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796351876; bh=XYBCIJWGQqipLhaYMSmWtyPmojaVr66Ilglkn9cXT4w=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=M68ODAdKZXxiJahwmB808po6m/wI9vi1K8t0BFx8YcGedQo55NsvQd1D5ELrWPJpr sGBhPVSoJPisnksAqm7HyZMD1eL6kDjSS8dJhdrHyhKaRRTdSAXwpf9HpU083sjAHY PjctmM3Ib8Q72nVG54what7eyXjVy3ABwXwXuxjrQRtAxOq19eKgY2hq9M2PofTGPm yUagyfmBaA3cQ0oeuGa4Z0zWlE78QSkqawt2p8siFAGlmTWfZyNj5bysHNRNXkkuTw bMWPp7QOkYl3ythQFeSCZyNUegctTijBnQXEnu2HxGUuu3WMN27YEqu4kZ/H7tYq2E ru0taQlaDRtPQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] dlm: fix out-of-bounds read triggered by short rcom messages Reply-To: sashiko-reviews@lists.linux.dev To: xuehaolin@uniontech.com, aahringo@redhat.com, teigland@redhat.com Cc: gfs2@lists.linux.dev In-Reply-To: <20261204021910.706512-1-xuehaolin@uniontech.com> References: <20261203070904.510344-1-xuehaolin@uniontech.com> <20261204021910.706512-1-xuehaolin@uniontech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 02:37:55 +0000 X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] dlm: missing dlm_rcom length check in dlm_midcomms_receive_buffer_3_2() -- commit 4e1720112a3b4b8b5636c0651ec522fee2cd7dfb Author: xuehaolin dlm: fix out-of-bounds read triggered by short rcom messages This commit restores the sizeof(struct dlm_rcom) length check in dlm_midcomms_receive_buffer_3_1(), adds a matching check at the entry of dlm_receive_rcom(), and rejects negative lengths in _dlm_master_lookup(). [ ... ] > diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c > index 488a58f2c00b4..b904445be4765 100644 > --- a/fs/dlm/midcomms.c > +++ b/fs/dlm/midcomms.c > @@ -823,7 +823,12 @@ static void dlm_midcomms_receive_buffer_3_1(const un= ion dlm_packet *p, int nodei > =20 > switch (p->header.h_cmd) { > case DLM_RCOM: > - /* length already checked */ > + if (msglen < sizeof(struct dlm_rcom)) { > + log_print("rcom msg too small: %u, will skip this message from node %= d", > + msglen, nodeid); > + return; > + } > + > break; > case DLM_MSG: > if (msglen < sizeof(struct dlm_message)) { [Severity: High] Should dlm_midcomms_receive_buffer_3_2() also restore this length check? Commit 63e711b08160 ("fs: dlm: create midcomms nodes when configure") dropped it for both versions, leaving the same stale comment before the switch on p->rcom.rc_type in dlm_midcomms_receive_buffer_3_2(). A 16-byte DLM v3.2 DLM_RCOM message triggers a 4-byte out-of-bounds read. A 20-byte DLM_RCOM_STATUS for an unknown lockspace also bypasses the new guard in dlm_receive_rcom() via dlm_receive_buffer() -> dlm_send_ls_not_ready(), which reads rc_in->rc_id and rc_in->rc_seq past the packet and sends 16 bytes of heap memory back to the peer. Adding the check before reading p->rcom.rc_type in dlm_midcomms_receive_buffer_3_2() needs to jump to out so nodes_srcu is unlocked. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204021910.7065= 12-1-xuehaolin@uniontech.com?part=3D1