From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 69AA63B4E9F for ; Tue, 26 May 2026 09:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779787868; cv=none; b=oAj3SZyJxeDirFWAO5kdeC/U6AfpyuvZQHlryaoUaBEpZXA+a9iTJ0dD2/JEY1vIadB4kBLsrOd7WJhTYAE+DcxN05IiijeQ4vlLRsznVgNpB77GbvtLb6NA0Fd+usWkz5Em2XZP+6XExEWuZSGt2liU0zmKDw6HceD8yhYJnDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779787868; c=relaxed/simple; bh=uvz/kgTUH5nCjt/wXXr7H3t+qy4vkWiuM6wRqHR4LwU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AQUxicdINpLbp9ZNZSwS5Y6el72BZxRBNagK9Lqt2V5okpZoLIutJgZZisLX4NW/W3bLy6ng78T4SLawlkbLsgbw1iLUieUfNtbrrK+yp6RZFNyT+f/tny30qkhfkh92cGv4CZ8oYd0OAOvKizhOUT4gBP27EMJaYvDWGswUuFA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fk5w4p22; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fk5w4p22" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4891c00e7aeso71363075e9.2 for ; Tue, 26 May 2026 02:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779787865; x=1780392665; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=lhyGEGziB4p1he7Kr6BJJdkSVJk+rI4Mohkv26Jk0G8=; b=fk5w4p22H469kjTbAqXGPjbdafQqqIhAKUOmSuq0hdyM6mOLidAfdQduJ5hmt1nn8s Zn36+AYkcwj2+Zy616X6CLrIN72cQlp0J8bcyETDBA3rkXfu0KfxtepJ+X+fo1RjhbRh jqJYkxRqt5xdjkwusO4vMUEE2npOz6tKB9+QHF18MXRUk/qZdBbRQBTgEa6BHiypq7/5 zub+pc2EW5Gk9ct2FUNAKcT+Ft5gmJ8pzrA8975rWPxalQVGhBUP3t15njsbHDqR8c3K mZiCys7KO4zb/Hao7KCHaCh3J4PPMqtgEWH99+oWJTHihC3xSZp2lZMLdVL/1PMwpkgH nyjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779787865; x=1780392665; h=content-transfer-encoding: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; bh=lhyGEGziB4p1he7Kr6BJJdkSVJk+rI4Mohkv26Jk0G8=; b=Q0ni6g/1y91RJTZ0TcwkOTFAWeDvtgIlJmTvMnp8mBWOKvSKsbV1h4x3l+sb+j8I3H sPXki1L9TkMuwMlNMOZZqw40TXlVlIrdAj6uhj+9/6ZXZRX2pr/9Sc2tEIjR31O1RGBs I4u+b9POLV6lg8m1oROeFzATqZ1KcVCEPNdGTrsjWT/PngPSdav0fPC78DZ8oP/FsF4A G8BPhbxFQxhFjeasFq/WmUgPtXtJLBYTkIZYQqt/YOIWFCQBVM7r2xUPsHWsvjv0u/Fu 5/Go1PbcDj/kFBGQ6VH3Mdk2iKcQi0gqnurSAoCnlisvDBdT5F7r2h0+9vXrXdqQgWB7 FwBQ== X-Forwarded-Encrypted: i=1; AFNElJ/k1vd/uP6aVJlIzfUUlDxNMk42v9X2WSIweXNo3/8YLRdG1h3O5Rgxufs4pbSTXYAFkp9gtUdC7RW1Kcc=@vger.kernel.org X-Gm-Message-State: AOJu0YxD3an0M1zSUVoRXLPQvDqyWqVZVveI9DWOp59sfvqhqBw4OYvF X6DQXlmZMyK6f+oWRNQ6J6ByVnLV8UdzUgsEQHuP7vLP45cllrG6mm9E X-Gm-Gg: Acq92OGGNKzjKyrXswiJU12JN8U3Xg1eyuBkefOX/yrNmD0fA+mDOHyTOjZEGXT8mSH v10uZkJgJ2urt2wRSKCoq8DKne8ZO0W1rkDFjl6zKw37J07+5+s4PjN8o6fXev9y3432lHFolsZ o3UuTyUrHI2dQSby8c7fIEaR/nP/Vkqfcz1tZkn9o9OBh9ciu0E7stiF/rJXVdIyMZ1bNjRKnDd Kn/rggO/SXrlW21KPxYR03aMGzy6/yzTixzwQBgntFirhCoXVAnVjStY/iXG8qNsemI4ssDZiAN 5eDLrlktssqPg58Nc+hBR2iVoYrpc04M1vu5QfP8tO2BXRMa224EK5bIcxwIDJi8evB3BSEFEWx 2DlmFD8TA5OXmUZxSyVEJ3P/wgJuElWRa943PghHAlVvqhnac/z6YrG1oLj8/QVox82b0Pb9LvS OwhVluf7gbpRtqcNDlMW1Ybj5dohWGXua3UrKjnR5++Fuo65lGxP7Hf/7CA/OJw5ht X-Received: by 2002:a05:600c:4ecc:b0:490:3c90:2cda with SMTP id 5b1f17b1804b1-490426cef73mr281947435e9.20.1779787863622; Tue, 26 May 2026 02:31:03 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45eb6d4741bsm35437657f8f.22.2026.05.26.02.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 02:31:03 -0700 (PDT) Date: Tue, 26 May 2026 10:31:02 +0100 From: David Laight To: Fernando Fernandez Mancera Cc: Florian Westphal , Kacper Kokot , Pablo Neira Ayuso , Phil Sutter , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] netfilter: TCPMSS: fix dropped packets when MSS option is unaligned Message-ID: <20260526103102.003aedd9@pumpkin> In-Reply-To: References: <20260525201116.407338-2-kacper.kokot.44@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 26 May 2026 00:08:15 +0200 Fernando Fernandez Mancera wrote: > On 5/25/26 11:28 PM, Florian Westphal wrote: > > Kacper Kokot wrote: > >> Padding TCP options with NOPs is optional, so it is legal to send an > >> MSS option that is not aligned to a word boundary and therefore not > >> aligned for checksum calculation. The current TCPMSS target is not > >> robust to this: when the MSS option is unaligned it produces an > >> invalid checksum, and the packet is dropped. > > > > Is this an actual, real world bug? This code is 20+ years old, all that > > this hints at is that they are always aligned in reality? > > > > AFAICS, these issues are not present in real environments as MSS option > is placed at the beginning of the options block making it aligned by > default usually. > > I would say this is more for correctness. I wonder, if we are touching > this code, we could use the opportunity to make it use > get_unaligned_be16() instead. gcc and clang convert x[0] << 8 | x[1] (etc) to the appropriate single instruction (and maybe byteswap) on cpu that support misaligned accesses. So there is little to gain from doing it any other way. -- David