🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23017

Re: [PATCH net-next v1 0/6] net: avoid stack canaries in TCP/IPv4 fast paths

#23017
From: David Laight
Date: Thu, 26 Nov 2026 10:20
29 lines
13214 bytes
On Tue, 24 Nov 2026 22:06:25 +0900
Xuanqiang Luo <xuanqiang.luo@linux.dev> wrote:

> From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
> 
> With CONFIG_STACKPROTECTOR_STRONG=y, a function that has a local array or
> passes the address of one of its locals to another function needs a stack
> canary. The canary is set up and checked on every call, also when the
> local is only used on a path that almost never runs.
> 
> This series removes the canary from functions of the TCP/IPv4 fast paths,
> by returning results by value, by using storage that is not on the stack,
> or by not calling a function that has nothing to do.
> 
> Patch 1 returns the two mptcp_space() values in a structure, so that
> __tcp_select_window() no longer needs a canary.

While all (I think) architectures can return a big integer in two
registers (dx:ax on x86), not all ABI do the same for small structures.
For those architectures returning a struct by value is implemented by
passing the address of a hidden on stack structure.
So code generation may be worse than passing the values by reference.
I can't remember the list of architectures, mostly old ones - but not
32bit x86 because the compiler option was set when regparm=3 was added
for 2.6.
(Note that this is different from passing small structures by value.)

David
Technical Details
Message-ID: <20261126102058.1fecf50f@pumpkin>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372031-linux-kernel-netdev=dewy.ru
References: <20261124130631.1886963-1-xuanqiang.luo@linux.dev>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372031-linux-kernel-netdev=dewy.ru
From: david.laight.linux@gmail.com (David Laight)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v1 0/6] net: avoid stack canaries in TCP/IPv4
 fast paths
Date: Thu, 26 Nov 2026 10:20:58 +0000
Organization: Usenet Network
Message-ID: <20261126102058.1fecf50f@pumpkin>
References: <20261124130631.1886963-1-xuanqiang.luo@linux.dev>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="438080"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:z+T6Bo++mnYRO8DhcHrnogZMlBE= sha256:rCbmuyv21tm88ldhdxxjU3fmEVHn/BOcGWL0rlpzx3o=
	sha1:o0e+tffQ8F4WViE2i1lBjNV/xOQ= sha256:gx2bTYHDMaPRUlGlfF56HxDjiJ6Hibdrm8qua3+RSUg=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6BB89125EC9; Thu, 26 Nov 2026 13:21:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id BgZnPotAo_pL;
	Thu, 26 Nov 2026 13:21:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372031-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 147F9125EC8; Thu, 26 Nov 2026 13:21:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7B0A82BDDA; Thu, 26 Nov 2026 10:21:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795688463;
	b=bqnkZ7c+qnfqEp/RabmP6Xn5lHvMUAHyYB09k6EGmgQZhM+StNfuGo/aKzK0HfvO034z
	 Bpdr0gx5RvQ1vkn6EpvnBtSgEv6EfYeWjcKT2mlRhDFEbDmQCt4TeT80xOkyqne1z6z27
	 p4Llecla5EXPyfxMtZpr3MJuHsdTeyH8sJj78gEQ9ABXSdL1ISnw4CVfix50CPadzUaWZ
	 PkHBUFj5CVkfyX2YPLDu/wBygdRVSplu8qJU+LJgan8zURe/2wmMK4e1kSyQw/fh8gW1I
	 632lsIUTlccaKN/KXHkuRfIdNASR0EUKn30RyY1V1VtYNb1ISkWX6id9JUl2+1J5IiQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795688463;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:
	 X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=Dz5Obh5lP0tOLHLiHWSWNzgVimL59XKVdrhzCbJPLAQ=;
	b=yhYq8IE4HISMV8w+QHAVrDZwp2BoeTjkWeU1tPgWXk9gAsb3ZKXO5xb41ecPKHGcUD1S
	 gA8ljB4o3EKaI2p1v6GOi+NwoOVXGSOgzP/mTIFbumLSBitmKEw3G3Hm4QtEA9G3iHN/A
	 Y+f48MMpW2v1WFccqpPjEjYHp37NJpiKic31PyHJmMFh6UMkDH1A2FFf7GuAmCt3+3C7W
	 IuX6fp0zjV+n+4Zk8OS8RXo5cr8nauPDS8oGw2L4BkANJrot49Xa13dmr8SYphNQduWhU
	 n1O388EQw0QTw1lpwvFxVh94Xvgqhhzro9NsQoVfFi1QbgkVnAL5EELG9MJGeYggjZg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="CD7VT//B";
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C0D7606A33B;
	Thu, 26 Nov 2026 10:21:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=CD7VT//B
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795688462;
	b=Wh0V7REDUrfoVjw5ngWcpQchv3gOtjnDOoZFgJEkPcd/q3nqCRr9OjtS4VHqDAHEw1ws
	 fIuLQX4FfLKnDz1TXxQY+nSvjc2nzYcgQ004RnlIB/vXRzSq5xuf1jTLAvPVo+zcdVRT5
	 OLozTBrD8Wn55CLnonaqicz1zjfUfTfzLOgBml0ZYsaagTFAFopnzdGnf+vjdaNTOIN2c
	 jKtzgwJq3Mr2JwiWSHY9+n87/dIVqC+5WaCRRgHRqwaqfFATC16cV1YEmEg2HoUMzcWHA
	 fT+jjV55PTgpGnd5ZTRbQqkXLlRP+Z7mcUhOvuCnQ0YVuVW5USqxdSRXccowgii0mFg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795688462;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc:
	 Subject:Message-ID:In-Reply-To:References:X-Mailer:MIME-Version:
	 Content-Type:Content-Transfer-Encoding;
	bh=Dz5Obh5lP0tOLHLiHWSWNzgVimL59XKVdrhzCbJPLAQ=;
	b=oW8eOpNN2POU305AM5L1JehIw0Q9Xt2nXuULmC2xCEnxuihsR2vWUxzUwTHITAY3KUys
	 o1HWumOe1R6XPbe2Q9smMJoYb17kQH5Yeujxgh/OX5O3F7slcKf4VNbb8PJfGcpeFZ0t3
	 1jekXMDLTxxX8yO68qwjHJS8mFe/RE0QGUa5aDh46iMvSINM9ke219RYZt8xyeqx3OKJz
	 ehUCyZ2Q7MdMYktMvEpu3FVYAMzcAd5fYxjBBIOn2/1RXCO09KlSTwFf/T3d4O6Cof90l
	 HinEp6zXybIFkpiqvsWYGtVlIqQUxyqQOXZZAIjzb/wmi1AFnN51whhncONaer881KQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="CD7VT//B";
	arc=none smtp.remote-ip=209.85.128.54
X-Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34CF4606A326
	for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 10:21:02 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 34CF4606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4ba013938d7so63883415e9.2
        for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 02:21:02 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795688460; x=1796293260; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=Dz5Obh5lP0tOLHLiHWSWNzgVimL59XKVdrhzCbJPLAQ=;
        b=CD7VT//BnwjcVd/x9W08z4hh0qia6Xph8wF/i4minXZySyXu8zsDolv0LFjazmM/6m
         pIGU6L76Mawk8H2KfnDIrG2oDmO7Tv7sO/LEOBXhymVTUcYfViwFwrXpTpNkkpHs8gl4
         otBJYE9GgyVPV2IUsre2NvaRLOV2zPcBDOjAv1YT/TJrss4Pq0CevX+URUlIVbdF1LB+
         iN55YZDkHNufNljGtkNuEStzk9IaQR+nbcYV+y7g4IE4bHodjC1+Z4Qpfkkd525fXANf
         yjTMIfngYNzhYLbG2HD7dSz7i6QkbKb7sIKmnwYNW0QDrTCnZACMi6z8+NrNv2a+YLfm
         iQJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795688460; x=1796293260;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=Dz5Obh5lP0tOLHLiHWSWNzgVimL59XKVdrhzCbJPLAQ=;
        b=W96K4JZWR8TN6pN/LRUmhMv7Pj/uGg24hnxtPJ9j52oURVJ+9hhoe6ErqX5aAyj9WA
         v7f9j6tiitrBfAX8KijYafAOz81mSRfl4ceslyYVdadbrQXfnHFuC2GbUt7tuzMLcc9M
         TKyBluba9mlPRGPGBd2F0rAW/XI9Wr51FO2iyrGhgSrJCdK9Yn+o9gfzeKUw/Ie0Qu5Z
         jaxOCr6SzZovzlkA7heyqIxBXD64TqfoPhcGxoE73doL2wiyS3kMk8Kzciw70FLUoXfl
         CwS1r2GZgFdHES3KjLQLH6/TZb8ZqGBIOzzgVA69I3KDiXQ9HVib+ByPVaKGJ5YqhfCD
         2hFA==
X-Gm-Message-State: APuU4Z80vqy43Z+mVG2OcAYA1XL3DPkcKAfi0SK2/iL0nQDtzl6uv4yN
	+jyrxgyFcybLmTzQ0cWXgCJUz1Y1sgqd173JgkWTzZpa+xAlnMn3Li6F
X-Gm-Gg: AZFdTZc+3OiwwAN+6Uz4HJRhIr5mUXuQm77P0MEt6jTqGzL8J07Grs0sohcKU6YUvm6
	fDOvRZ9BfqQ4Mvrl5xZap18QrwsP9YfsDL4Rojle17rSht2fLFfQbe/lhj+PyTU4it8NiBkpDN9
	rhh/hQlRcRhsNA+ty/8mZUC0ia8PEaUHAYkTWRMMB0gcHTd9Tkkk07ThYEZcSrEY6pLyh/5EQeg
	agute30ywbdzxGTRF16lai3o2IYHnlNDnaD8r3JXU2MUhYCAdPdlyMjz0lFqVqpAd1pZud8Z58F
	f78jA7aCYrOcSC7P//OpF7oVdLG0WyS2Ciyi3K4JVT3Ob1riM1HxMQ6EO5B1eSdixA7FpCrn+lA
	rvt+y/odLSmbb8ML2UfvvZA6zeb95q5Y3ATyPc8Y2nlaUiKlzWS+nYOZhxkAlKsHBQhQp1sbn04
	gjObZkl3ilmLgqBF4Aruzn/tWkjfxQyxnGmwlPqY5ZhokHGI1mWgdEK7lgOraVmcMRrunzL6U40
	tfVreNlnTVfgt0DOdD4fM4nuJzSRvDdoC21fN1q/0NIKQsaJYlz3Mn7MA3+WXMFnfS4g6vkA+9u
	/DuKnO9PAw1n47zn5tVXgTiYTCuQm/qympikixMArWw4M/drPNuGNiZFicFJ6HgYgA==
X-Received: by 2002:a05:600c:3ac9:b0:4a2:a3b:7aa8 with SMTP id 5b1f17b1804b1-4bb887e068emr432378915e9.3.1795688460499;
        Thu, 26 Nov 2026 02:21:00 -0800 (PST)
X-Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8538b2c5sm581334935e9.5.2026.11.26.02.20.59
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 26 Nov 2026 02:21:00 -0800 (PST)
X-Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>, Eric
 Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo
 Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Alexei
 Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, John
 Fastabend <john.fastabend@gmail.com>, Andrii Nakryiko <andrii@kernel.org>,
 Eduard Zingerman <eddyz87@gmail.com>, Kumar Kartikeya Dwivedi
 <memxor@gmail.com>, Martin KaFai Lau <martin.lau@linux.dev>, Song Liu
 <song@kernel.org>, Yonghong Song <yonghong.song@linux.dev>, Jiri Olsa
 <jolsa@kernel.org>, Emil Tsalapatis <emil@etsalapatis.com>, Ihor Solodrai
 <ihor.solodrai@linux.dev>, Matthieu Baerts <matttbe@kernel.org>, Mat
 Martineau <martineau@kernel.org>, Geliang Tang <geliang@kernel.org>, David
 Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, Stanislav
 Fomichev <sdf@fomichev.me>, Neal Cardwell <ncardwell@google.com>, Kuniyuki
 Iwashima <kuniyu@google.com>, Pablo Neira Ayuso <pablo@netfilter.org>,
 Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
 bpf@vger.kernel.org, linux-kernel@vger.kernel.org, mptcp@lists.linux.dev,
 netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Xuanqiang Luo
 <luoxuanqiang@kylinos.cn>
X-In-Reply-To: <20261124130631.1886963-1-xuanqiang.luo@linux.dev>
X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list