From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060550; b=gKz1VVswxQ+6uIiCYq0E3VA3xMAvmB4foecKVYItDerXM80/tZsyDv5t/McUQhfnCzh1 mkH5xJWvXR9wX/2/pa1WIIHgsq1oUzrVvGJnw2UEPgzN4ZABLi2Bui4Jf9uk6FUEg21Gy eS4uoiiFJ8U9FVo210TCHbHUdp786t3+YSAIc/EjquD4EPvVBV0b5wTtWPUs/L+ufV+r4 tIlp2aDIE62E0yDFjYUabg2bKvXmP6cu2IOfQfkCS7wh3XUBOfLZEESGoSuo0/E8TnVTL 3zISU/FTn1dh+BYkEHEo699RXkDkQCUAB7GVRBOkLCD3qdfY77OPJHKNsw4qUqmyFBA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796060550; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject: To:Cc:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=5yykWVM2Qg+YUVrJxQ/06E77dSTCuvmbCAq6S4RH8z8=; b=S7yxxsLuUXDSQkprOdnElxLZ+L/cOXMcM6ei2KXopjOKcglEbGfqmfG2tai48ngffAAx 2QpTJMVwPgngLQ9igzMjYJtbkTlZGTZEdfq/FvS8yQ5q7tI1LhJww6Ob89Z9TtGiBvQ3y B1IfEDOlR5qXPfMiNfvLnp0uiyti57KX2eHh7sWfbrbYD/LFLPHAno7KT8zZ6jVOuS58V KNUVnzTiJ0vr6o610Ih5ScmbJjLu1amazezcC2tCnBb5ro8+5i8DKexY96eyc5172yeLi zcOT/l7wAjrueq8pVNdQUEDIfQUG0ou11kW7YbbeeRqwi935k8e59K+gyDIARP6FAKQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VBm33rxz; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=ihVtm7RP; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0701F606A31C for ; Mon, 30 Nov 2026 17:42:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0701F606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VBm33rxz; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=ihVtm7RP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796060549; 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=5yykWVM2Qg+YUVrJxQ/06E77dSTCuvmbCAq6S4RH8z8=; b=VBm33rxztWYNsrBLeUxdCnYbjvrVgSE41EewY87U++XwDIiq6G9aw1C6xNoheWH3hriuko dWMf4WJ9H2a6D5HH6pkWToxhedXb6SsZspdu/j4CguCKBQUh/Gx1GB1pRrGpn2JdC6LqP4 QFYN9y68onkNamGAhJ3mR3F7hdbaLRI= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-351-V6Qg-RPYOQmjHS3uNVbRfg-1; Mon, 30 Nov 2026 17:42:27 +0000 X-MC-Unique: V6Qg-RPYOQmjHS3uNVbRfg-1 X-Mimecast-MFC-AGG-ID: V6Qg-RPYOQmjHS3uNVbRfg_1796060546 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4925ef75fc4so6467848f8f.1 for ; Mon, 30 Nov 2026 09:42:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796060546; x=1796665346; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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 :content-type; bh=5yykWVM2Qg+YUVrJxQ/06E77dSTCuvmbCAq6S4RH8z8=; b=ihVtm7RP7/SGEt3dQhSy7kRT5kwbqnmGtArz0tcV5mlsB2c66cB4jle+ZD6RoquJiB UwzC4HxqbEUWmuQe8Gsmrkf5ap2F1uxoXMi5yl6TkwPJuk2rJ1tNezHyijqs5yLj8USP zygWt/Ek0IcAjllscWNAh9H6yfHoHLdpHewi5OYV0pzJFm9Y/+9bTUsYTg/eWyVvop/4 zpGli+8julPQyr9l5ltZb1TCh8mV2p5qwgQK9DiSh/SqwC7sZot5NxxcF35MX3msu1lc 4ej2vcjHdS0QQzlZKhF/yXlwQX2HsDDpn+gaSq/imzzdiAdSg68EIHMxBbnz7H53RJ0b /jaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796060546; x=1796665346; h=content-transfer-encoding:content-type: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:content-type; bh=5yykWVM2Qg+YUVrJxQ/06E77dSTCuvmbCAq6S4RH8z8=; b=nFGwnjDs4R9EzkVY7C4abZtSZaylDftLrimpTHuJetbbCDNjpJCLCz86U/T4/ir9xZ 34LeQbSIhEpI8xtnw3xvfwNo8w+5xNx5YSWq5J38iR8opF2denckdxJnTfqML1fV4Mlv huvJIVGl3nD/EM8kB2GAD2h5GBLMH8nScfpwoDhwJfoqMlX13okDrPsCqqYa63kouq/5 pyJcJx9I7I1YB+1SeVVkAGZ/Eb034mKqbY27AeiXmRkexDJTMgLERGUsOUZVa1qPuxgz UUqIEEXlSY6SPRBeoLXVNL6C78HQt+bPkjOVtz9q5vjvKLlyYa0Reas5ueTJTzR5gxS6 MtzQ== X-Forwarded-Encrypted: i=1; AL+hErGO8tsxDhjiKCrFzgSJblD8yY5BsjeCpZ0S3bPSzL1N4H+7f/iVQ8UFfAul2DUqFCmU/yS8Rdk=@vger.kernel.org X-Gm-Message-State: APuU4Z8FLhx49GMvPOj8e+J7Ikk5qrdSG3sopysHtMnERdvitN9fcY05 sNfAjov9pIQf0BWBl3PaUm8LTeiOUEM2VR7y5bG613aJC0uhFvHrSwt/gSPCRWPVZ44iJGRnTDt gYPoOlHLY+x3ozGWyJj8vV6n813c5NiC0oVBWHySIDS2dcTNt+s+gVAaBZLDHnTjxZA== X-Gm-Gg: AZFdTZfNymOyW+nxRE/CZn36NsYHX+tJ6TWSx3N7fZC/z6HdQe3O4C48xAX+dKmP/mP 5jyp9jPUnoO9q0tvLPLJjugmyB16/Q1SisvKdnpM2X6++76xeX/LL8TfFOcZHzgMQw4wTy3QcCY ELb7zm1wIL+eer5p/WuYAVmHvBoxTwfQkudNDl8ZTd39qD3/imPK8vKKq80uv5IuV/DJXP7jWmb PrCjnm2Fj6H6g2K6xuTJUoK+KChl8FSlj82PTqpHLi85u+VK5JykTaeoBbxO9GXN/Sjy7O5mgnr ts1Kz/9D0bsWikqDIaZXH3GS1+VUNubD8bMJJ/07zxuGFngC3+pR10jrdntCJzMG1KlNyOSJFZA uBTTIlTJnFQdAL3qsPclgoo2/BrS/ObA6pdgF2tJtR2f7e/Q/rsfYGCtlRMtM5y9/ItrlTAj5ne 3gvrzIgMpFmnYtaDyKjV+4BA1FC+GPQp26to8BZhbNnqJ2 X-Received: by 2002:a05:600c:3b8a:b0:4bb:76d9:f81a with SMTP id 5b1f17b1804b1-4bb88824fc8mr713152755e9.34.1796060545734; Mon, 30 Nov 2026 09:42:25 -0800 (PST) X-Received: by 2002:a05:600c:3b8a:b0:4bb:76d9:f81a with SMTP id 5b1f17b1804b1-4bb88824fc8mr713152225e9.34.1796060545264; Mon, 30 Nov 2026 09:42:25 -0800 (PST) Received: from [192.168.88.30] (ip231-128-192-82.pool-bba.aruba.it. [82.192.128.231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb90660cb4sm935840935e9.2.2026.11.30.09.42.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2026 09:42:24 -0800 (PST) Message-ID: <072fefa5-bc5c-4493-93ba-a17b765cf05e@redhat.com> Date: Mon, 30 Nov 2026 18:42:23 +0100 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next] selftests: net: py: close the wait pipe after reaping a command To: Jingjing Xu , netdev@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, kuba@kernel.org, edumazet@kernel.org, horms@kernel.org, shuah@kernel.org, sdf@fomichev.me, joe@dama.to References: <20261122154827.1272059-1-xujingjing@cmss.chinamobile.com> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20261122154827.1272059-1-xujingjing@cmss.chinamobile.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/22/26 16:48, Jingjing Xu wrote: > Commands started with ksft_wait keep the parent write end in ksft_term_fd. > After communicate() reaps the child, that descriptor is still open, so > each completed command leaks a pipe in the Python process. > > Close the parent end after successful communication and clear its saved > value, before decoding output or reporting a failed child exit status. > Leave paths where communication has not completed unchanged. > > Run this from tools/testing/selftests/net to repeat the supported pipe > handshake. It prints 16 on the original helper and 0 with the fix: > > python3 - <<'PYCODE' > import os > from lib.py import bkg > child = ["python3", "-c", > "import os; os.write(int(os.environ['KSFT_READY_FD']), b'1');" > "os.read(int(os.environ['KSFT_WAIT_FD']), 1)"] > before = len(os.listdir("/proc/self/fd")) > for _ in range(16): > with bkg(child, ksft_wait=3): pass > print(len(os.listdir("/proc/self/fd")) - before) > PYCODE > > Found by AI-assisted inspection. Both this reproducer and a C helper > using the existing ksft_ready()/ksft_wait() functions confirm the fix. > Normal completion, initialization EOF and nonzero child exit each leak > 16 descriptors before and none after; ordinary and ready-only controls > remain clean. No kernel instrumentation or fault injection was used. > No hardware suite was run. Timeout cleanup and a child exiting after > readiness but before the parent's notification remain outside this fix. > > Fixes: 71477137994f ("selftests: drv-net: add a way to wait for a local process") > Signed-off-by: Jingjing Xu Note that this does not deserve the fixes tag: AFAICS selftest outcome (fail/pass) does not change, and no system resources are permanently leaked. This is a minor cleanup, dropping the fixes. Also please consider most substantial targets for other works (i.e. more reviews and testing are always appreciated). /P