From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HYw45MI/; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id BBB6F5A0271 for ; Sat, 23 Aug 2025 10:43:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1755938579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6FnRHJFSV3SreC1w0p6QNKVoKyAgLeDGHlww9MpDPB0=; b=HYw45MI/SfOEzMMiruhlfDk1FqwMjJcSRi9souKhcexGApxVGG+yJ4oez3MpO9agSie0xj NAjc0lspNu7wV9sKgQF1+Dg5SbJG17P5sJDpcRrFJNUfB9ne5wksyITBW2A7fctp7PgOkK XJiQo6GZX4l07DuEv16sQx6briQlC0s= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-CUHvpg-4PsSGsUr6TY_hdg-1; Sat, 23 Aug 2025 04:42:57 -0400 X-MC-Unique: CUHvpg-4PsSGsUr6TY_hdg-1 X-Mimecast-MFC-AGG-ID: CUHvpg-4PsSGsUr6TY_hdg_1755938577 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-45a1b0cc989so19339225e9.3 for ; Sat, 23 Aug 2025 01:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755938577; x=1756543377; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6FnRHJFSV3SreC1w0p6QNKVoKyAgLeDGHlww9MpDPB0=; b=JMD6vU1jiR0H6JsEnMBIRaPv9RTr76YCQn+MwWCw2zKCe3P5cWBIbBhyer+XSFgob8 Jw1XCVkcfj5oW6pbL1vChEss2Lc5RJBqxQjnmQdyAdQacPRT9MXzUFzENYwtHhH8iPCK 2AdNsuNRbSlgwA5d1cQumv6PJyfnY/hK8n4eO0pJPlY3DxyyJ8YJ/nZoiOP0JghXMpvW vErs1xW4G3qFCx6p8Atwepa1UGxQcpD1dHkrGYBt48zPpkl6O84GztGd0b24MZ+rchTM hKZMgD3EQ0fYssMmGBK977VkdshWRhoTKIh7pMdAp32njDjRzSQ4u4lOJumMC0nIEV5O LkjA== X-Forwarded-Encrypted: i=1; AJvYcCWfQM1TngG3chw7Mjf9ffLZcSUEg98rkAM52JdWMD1941viW/YM2lNiYI3DNhIRVqi8CVsdpw64oLo=@passt.top X-Gm-Message-State: AOJu0YyvI2qhY/kCljZRmq9Usklvjs9SsCvx5jyfihuyGHg5VN+lE8AJ 6upz7cg+NUOs0sUsHAT0Kx5B/tPRFDcvZsAinYE8vxMj2X3KklxP/hkm13JYNOSoVDoKgajBY6o pKm18CkKAZ6D78ueW33QFG6ELyqJ3xNoh2flKD7+CgW1/aHFsH1Xz3A== X-Gm-Gg: ASbGnctB1/coCvAVq2Ibg+lLhJwJcwcqqw/OQUFJ4YywJdnR+sfDfl37SwHyT7nDSJ+ gxvOPlW/0mClZ0p0vYAnh7dZr9clSlrQN5aoqGhFEdkBp0I3RiUfOObv57VPqGduZMoyBi2KbSK 34Ncb/p2gyGcgmzgmPid8l/vWsn7GWzrqsUDq1mYkFquJteZZ2ZYVrJcUYItjK9VWRhhfZuDKDW VPK7KuL8HWYvcaXXcHMV4g5JUvNpr9GU/Rk+wgI6YfZncaAYLFj6hrDUyNeyJcqulg15C2BPH6d KDUo7Hu6Xzh3kQxHWLNeZYB5uPZvvK+BxBXxmyt08lZmp3SrME4= X-Received: by 2002:a05:600c:5493:b0:459:d709:e5a1 with SMTP id 5b1f17b1804b1-45b53af6c77mr48705475e9.6.1755938576701; Sat, 23 Aug 2025 01:42:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6NjHGHYqMJ8ulZ9is0JehUqd1MHmd37Qkuu9GJeF/qPZl1+eYwVAU/3Y3IK1AImm7nVQHsw== X-Received: by 2002:a05:600c:5493:b0:459:d709:e5a1 with SMTP id 5b1f17b1804b1-45b53af6c77mr48705185e9.6.1755938576230; Sat, 23 Aug 2025 01:42:56 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b57444963sm31535055e9.3.2025.08.23.01.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Aug 2025 01:42:55 -0700 (PDT) Date: Sat, 23 Aug 2025 10:42:51 +0200 From: Stefano Brivio To: Andrew Morton Subject: Re: [PATCH] proc: Bring back lseek() operations for /proc/net entries Message-ID: <20250823104251.49a8caba@elisabeth> In-Reply-To: <20250822160904.6c5468bce2200cf8561970d7@linux-foundation.org> References: <20250822172335.3187858-1-sbrivio@redhat.com> <20250822160904.6c5468bce2200cf8561970d7@linux-foundation.org> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dsYPDL6ICqf4U0hRrHJ-wAtFUZzL4UPPM7gjsYuSSzs_1755938577 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: FXYMRFKSQW5WR4EQ3HTN2PQ7CXJUS5JJ X-Message-ID-Hash: FXYMRFKSQW5WR4EQ3HTN2PQ7CXJUS5JJ X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, wangzijie , Alexey Dobriyan , Christian Brauner , passt-dev@passt.top, Al Viro , Ye Bin , Alexei Starovoitov , "Rick P . Edgecombe" , "Kirill A . Shutemov" X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 22 Aug 2025 16:09:04 -0700 Andrew Morton wrote: > On Fri, 22 Aug 2025 19:23:35 +0200 Stefano Brivio wrote: > > > Commit ff7ec8dc1b64 ("proc: use the same treatment to check proc_lseek > > as ones for proc_read_iter et.al") breaks lseek() for all /proc/net > > entries, as shown for instance by pasta(1), a user-mode network > > implementation using those entries to scan for bound ports: > > > > $ strace -e openat,lseek -e s=none pasta -- true > > [...] > > openat(AT_FDCWD, "/proc/net/tcp", O_RDONLY|O_CLOEXEC) = 12 > > openat(AT_FDCWD, "/proc/net/tcp6", O_RDONLY|O_CLOEXEC) = 13 > > lseek(12, 0, SEEK_SET) = -1 ESPIPE (Illegal seek) > > lseek() failed on /proc/net file: Illegal seek > > lseek(13, 0, SEEK_SET) = -1 ESPIPE (Illegal seek) > > lseek() failed on /proc/net file: Illegal seek > > openat(AT_FDCWD, "/proc/net/udp", O_RDONLY|O_CLOEXEC) = 14 > > openat(AT_FDCWD, "/proc/net/udp6", O_RDONLY|O_CLOEXEC) = 15 > > lseek(14, 0, SEEK_SET) = -1 ESPIPE (Illegal seek) > > lseek() failed on /proc/net file: Illegal seek > > lseek(15, 0, SEEK_SET) = -1 ESPIPE (Illegal seek) > > lseek() failed on /proc/net file: Illegal seek > > [...] > > > > That's because PROC_ENTRY_proc_lseek isn't set for /proc/net entries, > > and it's now mandatory for lseek(). In fact, flags aren't set at all > > for those entries because pde_set_flags() isn't called for them. > > > > As commit d919b33dafb3 ("proc: faster open/read/close with "permanent" > > files") introduced flags for procfs directory entries, along with the > > pde_set_flags() helper, they weren't relevant for /proc/net entries, > > so the lack of pde_set_flags() calls in proc_create_net_*() functions > > was harmless. > > > > Now that the calls are strictly needed for lseek() functionality, > > add them. > > Thanks. We already have > https://lkml.kernel.org/r/20250821105806.1453833-1-wangzijie1@honor.com > - does that look suitable? Sorry, I didn't spot that one. It sure does! -- Stefano