From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E444A44AB6E; Tue, 21 Jul 2026 21:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670835; cv=none; b=odI1JXVY6mXDh3s3oEZId4xQnRiguAZUVfb7UlRVayoNS43sJ2Gdm3BsScGtzEwKPTrwbV4Zcv4+pQw9AbHs1nsxgxDvtMlKtbbCWKgozoPXLV9gHd/PlhZQmAQMzMco5Ip2uvpTbpxXK0V+J1FD4IeK2o40bkBrCsSjmSqzSAc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670835; c=relaxed/simple; bh=AjJLHmTKCmMOls8Zh3584RLqdRi7tE0yNNr3DLOUoSg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ccc2RoaaKBgiLso3ctBCUnPxkPLHEcSp/hbM8cL2e6Hnmr2ZwyrCOgr9ziJgBGZ5RtKYL/mtzo4MHIs9mxwCROszBve72KvmJxY8E7QMopcq7A97pRvJDj09Lp03LUpad2zdihIXa+3vzeJyYmM9ycM4qOaAgRmhwV/WU7/IvCs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=I8CLME1E; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="I8CLME1E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C0BC1F000E9; Tue, 21 Jul 2026 21:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670833; bh=yEP94CwGrATw6ZSve0FZibgBrggnLFKD8Bz4qQkNzaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=I8CLME1EMc1fDZ8dMQklTjOHFe8Gehdbygx6ctIbG9GPJFjYdl/FanqIPOLqWiEdt 7qlJ2WERfflswDKn7CjAoxc3R2k9JVCVODw3LrxZf4lN40twd7Ezox7AsawcizHOvV GcyP2ZpJ6dS3TtidmLROVuQsZM81FKP2IXv1KdEw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 019/843] skmsg: convert struct sk_msg_sg::copy to a bitmap Date: Tue, 21 Jul 2026 17:14:14 +0200 Message-ID: <20260721152406.392241570@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 5a8fb33e530512ee67a11b30f3451a4f030f4b01 ] We have plans for increasing MAX_SKB_FRAGS, but sk_msg_sg::copy is currently an unsigned long, limiting MAX_SKB_FRAGS to 30 on 32bit arches. Convert it to a bitmap, as Jakub suggested. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Stable-dep-of: 406e8a651a7b ("net: skmsg: preserve sg.copy across SG transforms") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- include/linux/skmsg.h | 11 +++++------ net/core/filter.c | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) --- a/include/linux/skmsg.h +++ b/include/linux/skmsg.h @@ -29,7 +29,7 @@ struct sk_msg_sg { u32 end; u32 size; u32 copybreak; - unsigned long copy; + DECLARE_BITMAP(copy, MAX_MSG_FRAGS + 2); /* The extra two elements: * 1) used for chaining the front and sections when the list becomes * partitioned (e.g. end < start). The crypto APIs require the @@ -38,7 +38,6 @@ struct sk_msg_sg { */ struct scatterlist data[MAX_MSG_FRAGS + 2]; }; -static_assert(BITS_PER_LONG >= NR_MSG_FRAG_IDS); /* UAPI in filter.c depends on struct sk_msg_sg being first element. */ struct sk_msg { @@ -236,7 +235,7 @@ static inline void sk_msg_compute_data_p { struct scatterlist *sge = sk_msg_elem(msg, msg->sg.start); - if (test_bit(msg->sg.start, &msg->sg.copy)) { + if (test_bit(msg->sg.start, msg->sg.copy)) { msg->data = NULL; msg->data_end = NULL; } else { @@ -255,7 +254,7 @@ static inline void sk_msg_page_add(struc sg_set_page(sge, page, len, offset); sg_unmark_end(sge); - __set_bit(msg->sg.end, &msg->sg.copy); + __set_bit(msg->sg.end, msg->sg.copy); msg->sg.size += len; sk_msg_iter_next(msg, end); } @@ -264,9 +263,9 @@ static inline void sk_msg_sg_copy(struct { do { if (copy_state) - __set_bit(i, &msg->sg.copy); + __set_bit(i, msg->sg.copy); else - __clear_bit(i, &msg->sg.copy); + __clear_bit(i, msg->sg.copy); sk_msg_iter_var_next(i); if (i == msg->sg.end) break; --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2660,7 +2660,7 @@ BPF_CALL_4(bpf_msg_pull_data, struct sk_ * account for the headroom. */ bytes_sg_total = start - offset + bytes; - if (!test_bit(i, &msg->sg.copy) && bytes_sg_total <= len) + if (!test_bit(i, msg->sg.copy) && bytes_sg_total <= len) goto out; /* At this point we need to linearize multiple scatterlist @@ -2883,7 +2883,7 @@ place_new: /* Place newly allocated data buffer */ sk_mem_charge(msg->sk, len); msg->sg.size += len; - __clear_bit(new, &msg->sg.copy); + __clear_bit(new, msg->sg.copy); sg_set_page(&msg->sg.data[new], page, len + copy, 0); if (rsge.length) { get_page(sg_page(&rsge));