From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46974301704 for ; Sat, 31 Jan 2026 15:53:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769874840; cv=none; b=hoeLdvaRHWoOoG/pJS3xoYjHlekrb4+NheF0FbfcsX1945ibobG7y5T1Z6qemDsSx2YwZxu50ks3Zk9KvCT9SoXTAE3q62Eg+cP6tpT2cvynPkDePKr99xMYeAHziYMrqtcZIUknbjBmFV4MItbsV8g30p7M3M3S6S5XMBuL5KI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769874840; c=relaxed/simple; bh=gPxfc1Or7MT2TMudnUd49s5dM7oxPJDUq2h82ELaFPw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aiXlbN/rerWgJcTZhh+Q0uqMZBdlRgErlUUZ4GjcVW3R6TLm8JVqUgCoCqRQBT1atz7+LV3lNeigKZIn9cIbkbvDEcwQsxzfi7O2MjuLV8dna7V5nnbwwfLcGwNpOP6mwYylXs/mDwOgdcqxUJR/Tmj+EOKQZg45hRnd6awBiwU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=1/qmmZkQ; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="1/qmmZkQ" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-45f09874c4cso2132534b6e.3 for ; Sat, 31 Jan 2026 07:53:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1769874837; x=1770479637; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=es4JeecL4qbaq7ZMUlzngsGo7GQdpeuMD9cshqCD5BM=; b=1/qmmZkQfk4elnkxUBpqoKRBAIivPPZdTNmiwiENMhuOS/QNdRTSkGOweWlC9X1KRI cRvXaAIDutBaTjj9p1e6bq24dcSaZWTUEAGKrkDnA9qmF12rg1AjbBar7lrHiWgnxcHo Yi8q3pGLIXW45c5VR53s4g8SyNM8e9IxlrUTed5w+lWMcpEgxWclCMLKyz9KVkTreuLN 0Yh0NLzGV+ycaLPti7ydUniUYwde4pukoltkPUYFveJhVTLezSUwva0ZWtXF3B1REL8/ BY16sbbnabFPkkF65EpRjccfNyYtrWtf88SZH4sbOvzC7WFsZNPaAZDimoFSsTpmuC5M PR1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769874837; x=1770479637; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=es4JeecL4qbaq7ZMUlzngsGo7GQdpeuMD9cshqCD5BM=; b=j3RBOfTa+DpeYsKhIP8OJhA4SUeYsNBjVQzn1uDnkjKgiPt89jXqEESELFaCU2STfY plvksOeKTtQfV56rm3B4Y6PcHavTXxywi5vcHxM0oLxL/bo0LeA0Sv7KpQgjrk8ACtIz /3nG5MEfhJgpZ1fzijYVhiU2nnR/o33AtcijJ660jSomo6eWG80aL2fDkKm4OIy+PKva dWdSjNAoOViGv0hK3WPJUc/UukCSPfqIXNk/y2rmzMYJW3uMH3fX2G9kGX5C4JB8aqHy U2hJjCylM31U6U54io6qltVA8GU+H4ikLxjDIS2PrGxNwyJDoabziPy1mXiGa0NA8t8X kkwA== X-Forwarded-Encrypted: i=1; AJvYcCVGEhltsHcXsbtA9nDya/PlKZOW1+RoWecbu7XRPhH6HnXV/tzaIVhRUu2UCLNzv7N6w5UWMcmjGTxZrf8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8R10eb418h1ab2zgX7jGiqSPYiNbHY4UaTF7UoHLP35Gw2maH wmHwlJeYjqUYeI149bz6SL69I/NBpHYw5acoR3RueWz+cQQ4pBaHOPg6ddFCYJlKf54= X-Gm-Gg: AZuq6aLbQfUqHxJyHBnxw6+aetcjInbLqamFjdL2zs2Pt3RJiY0VkYN5Xy7braCu3d/ N1GkjoWfTAPFvYpNJO3zngMoYK244dZQNctrigaCuX4GRveqLN7eKCa31aMgdL/j2WHCXq3QSp0 dBJ/jhAxbMsvVIyM34gzo3dWgx1SGRvo6/bq8AHBVsVTQ9jdqJm58A39NbrxjqvwbZbqNe9yiGN NV9bhtpFu1iVnzvu3jrw/tDk9b9AwFGHulPbFJZOSC8c7r12FkM7McLJceMjZslB9b09OKYCpFk yrIKerfjq4ZKcHuO5hQ0slVi2tI+ilPCmn8wgAY0ZvKsXx9LGgNHrriX/+rvYaOBI/AE3csW3cN bwWZ7ecFLMgNiAb+ZEzuRGqj27u1q98bvIIZnur3zoDIQPNaWqnZZgC+LxRBvdGsnRxlRpTeriN 9L0XBmVHZ03ePQxyeypwBN957ePViaan6W23sXXdGRymjrZ5DH7ACKuBrU5YX9+2SUBml+oQ== X-Received: by 2002:a05:6808:4fcd:b0:44f:f747:f9f with SMTP id 5614622812f47-45f34cd0c5cmr3020550b6e.36.1769874837163; Sat, 31 Jan 2026 07:53:57 -0800 (PST) Received: from [192.168.1.150] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 5614622812f47-45f08fb635csm6413741b6e.21.2026.01.31.07.53.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 31 Jan 2026 07:53:56 -0800 (PST) Message-ID: Date: Sat, 31 Jan 2026 08:53:54 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next RFC 0/3] net: move .getsockopt away from __user buffers To: David Laight , Linus Torvalds Cc: Breno Leitao , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Kuniyuki Iwashima , Willem de Bruijn , metze@samba.org, Stanislav Fomichev , io-uring@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com References: <20260130-getsockopt-v1-0-9154fcff6f95@debian.org> <20260130205227.6fb1d9ad@pumpkin> <20260131153735.3c9273a8@pumpkin> Content-Language: en-US From: Jens Axboe In-Reply-To: <20260131153735.3c9273a8@pumpkin> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/31/26 8:37 AM, David Laight wrote: > On Fri, 30 Jan 2026 17:19:55 -0800 > Linus Torvalds wrote: > >> On Fri, 30 Jan 2026 at 14:40, David Laight wrote: >>> >>> There is not much point making the 'optval' parameter more than >>> a structure of a user and kernel address - one of which will be NULL. >> >> That's exactly what we do *NOT* want. Because people will get it >> wrong, and then we're back to the bad old days where trivial bugs >> result in security issues. > > It can still be a (semi-)transparent structure that code isn't allowed > to change. That is no different from using iov_iter. Then why not just use iov_iter?! FWIW, I fully agree with Linus on this one. We have an existing abstraction, we should use it. We've previously optimized common cases, like ITER_UBUF, if that ended up being important. We're better off using iov_iter and improving that, rather than some new mixed pointer abomination. >> Can you point to an actual case where setsockopt / getsockopt would be >> performance-critical? Typically you do it once or twice. > > IIRC a really horrid one - I think for async io. > That is also one of the few where the supplied length is a lie. Huh? -- Jens Axboe