From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id B61CA5A027C for ; Wed, 29 Nov 2023 15:32:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701268364; 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=gCYAe2vTWza/874LuGI5t5XedwBglZL4G9ST9Cil/H8=; b=gQVPhexRRxfETPeYT1LDEKaBbrqjHVwWe3x6ENEl4fhXw8csRSLiIB786Xi7iKneTFZ6EU s5D9HhahiisuUYzCmUW4D+DMn8YdF+G5ASk/Qn1n8ldzHUFH8y8PIfWP0CsxwKd2MOjDJv rjUzHreyczHLUSS5QlXgIP7iBrNgRHY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-530-A25wHzIPOBSiNFDcTP-DCQ-1; Wed, 29 Nov 2023 09:32:42 -0500 X-MC-Unique: A25wHzIPOBSiNFDcTP-DCQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 578403C28648; Wed, 29 Nov 2023 14:32:42 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88C582166B28; Wed, 29 Nov 2023 14:32:41 +0000 (UTC) Date: Wed, 29 Nov 2023 15:32:39 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2 08/11] tcp: Remove unneccessary bounds check in tcp_timer_handler() Message-ID: <20231129153239.2df7ee71@elisabeth> In-Reply-To: <20231126233348.1599864-9-david@gibson.dropbear.id.au> References: <20231126233348.1599864-1-david@gibson.dropbear.id.au> <20231126233348.1599864-9-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: NJMVH6H5JPINGP4MR7IA55CN7NSJJRJ6 X-Message-ID-Hash: NJMVH6H5JPINGP4MR7IA55CN7NSJJRJ6 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: passt-dev@passt.top 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 Mon, 27 Nov 2023 10:33:45 +1100 David Gibson wrote: > In tcp_timer_handler() we use conn_at_idx() to interpret the flow index > from the epoll reference. However, this will never be NULL - we always > put a valid index into the epoll_ref. Simplify slightly based on this. Sorry, I missed this during review of v1. I have mixed feeling about this, and I don't think 11/11 changes anything in this regard: we have to trust the kernel, as there's no benefit to security in not doing so. At the same time, should we ever get an out-of-bounds index from the epoll event, we can fail gracefully here. Slightly worse, however: if we get a timer event for a connection that's already closed, we'll happily go and try to manipulate its timer (with or without the !conn check). All in all, I think the check is minimally useful, and we should have something more robust than that. So if this patch helps keeping things simple later in the series, I don't see an issue with that, but perhaps we should add back a more sensible set of checks later. The next patches all look good to me. -- Stefano