[{"id":3678955,"web_url":"http://patchwork.ozlabs.org/comment/3678955/","msgid":"<aeM5TqWUHDo_Xjv0@chamomile>","list_archive_url":null,"date":"2026-04-18T07:57:02","subject":"Re: [PATCH 1/2 nf] netfilter: nfnetlink_osf: fix out-of-bounds read\n on option matching","submitter":{"id":1315,"url":"http://patchwork.ozlabs.org/api/people/1315/","name":"Pablo Neira Ayuso","email":"pablo@netfilter.org"},"content":"On Fri, Apr 17, 2026 at 06:20:56PM +0200, Fernando Fernandez Mancera wrote:\n> In nf_osf_match(), the nf_osf_hdr_ctx structure is initialized once\n> and passed by reference to nf_osf_match_one() for each fingerprint\n> checked. During TCP option parsing, nf_osf_match_one() advances the\n> shared ctx->optp pointer.\n> \n> If a fingerprint perfectly matches, the function returns early without\n> restoring ctx->optp to its initial state. If the user has configured\n> NF_OSF_LOGLEVEL_ALL, the loop continues to the next fingerprint.\n> However, because ctx->optp was not restored, the next call to\n> nf_osf_match_one() starts parsing from the end of the options buffer.\n> This causes subsequent matches to read garbage data and fail\n> immediately, making it impossible to log more than one match or logging\n> incorrect matches.\n> \n> Instead of using a shared ctx->optp pointer, pass the context as a\n> constant pointer and use a local pointer (optp) for TCP option\n> traversal. This makes nf_osf_match_one() strictly stateless from the\n> caller's perspective, ensuring every fingerprint check starts at the\n> correct option offset.\n> \n> Fixes: 1a6a0951fc00 (\"netfilter: nfnetlink_osf: add missing fmatch check\")\n> Suggested-by: Florian Westphal <fw@strlen.de>\n> Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>\n\nReviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>","headers":{"Return-Path":"\n <netfilter-devel+bounces-12013-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","netfilter-devel@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=netfilter.org header.i=@netfilter.org\n header.a=rsa-sha256 header.s=2025 header.b=ma5lA0yo;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-12013-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=\"ma5lA0yo\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=217.70.190.124","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=netfilter.org"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fyPHL68rXz1y1V\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 17:57:34 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id B5577301AF61\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 07:57:09 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id F3FE537106D;\n\tSat, 18 Apr 2026 07:57:08 +0000 (UTC)","from mail.netfilter.org (mail.netfilter.org [217.70.190.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 695B13264FD;\n\tSat, 18 Apr 2026 07:57:07 +0000 (UTC)","from netfilter.org (mail-agni [217.70.190.124])\n\tby mail.netfilter.org (Postfix) with UTF8SMTPSA id 857E960177;\n\tSat, 18 Apr 2026 09:57:05 +0200 (CEST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776499028; cv=none;\n b=j2wXoFdkUveP9Qn8xxlvKnJMJyBP4gy6DyqlCXzQlryYoF1XVOYQj3oaHWawzBu06IpmtFkCKHskNAbPhkb9qx6azv9yjF84QHKc5vy2UgldocjZfwOTXtZMw0oYeNxrdk+GiTA96ePxVCTnNv9xud5k6pzrqs2rUcA3vV4rjO8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776499028; c=relaxed/simple;\n\tbh=sXZNcQN5qLEfGINhffRofI6HShQsmu52RA/Om0mCraA=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=O2KRbLMLeS92pBV2MuF5fiiB/IilVr9kIP89ehRsSnI+Npm1BImfYIOnsUTTgKQ5PP06stXEuYFxp/KSVK8ewcoVCkpQLbKukMVyNnE34kYFmU5+jD8JdFBVUaLkpknTO3NiLY2wKxaXdHuhZFc5/RHmpHheaPp+sVUoXUH4VkE=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org;\n spf=pass smtp.mailfrom=netfilter.org;\n dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=ma5lA0yo; arc=none smtp.client-ip=217.70.190.124","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org;\n\ts=2025; t=1776499025;\n\tbh=dxmc6OWY8WPYOEe1da+mGgVbJbb7u1BKfcC7XZPciUo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ma5lA0yoOqMTqGIC1E2NWjFb7lmCCuGS3z5DZxOpU/z0s9dhwNBgykNM9hks+f/nf\n\t 5qHGxkG16cis0U5np0HnbTBVhxQ922fEvuH8ftuGqEU5jIjEd6ZeZK41hJAjhcavSf\n\t WRFjIeP94HphJE8CTyeZgfjLq+Z6fM7zocNZicbgFYZTgOyWIq1+fOpDUTwaFmhkzX\n\t Wdhc8FxQ2z41f4sJoUfJ2QUZpIDpaA1Ys/SPdBijDJ+YNYoe7ZRf+ich09KaXlkJSc\n\t cqImBABDyJ0AK2p5t6vvAzVfd6+xOmvvDzUPKF0lXaIx4z2EJUJsFCJKZmFIHUQZXm\n\t YQjXAllEAatmg==","Date":"Sat, 18 Apr 2026 09:57:02 +0200","From":"Pablo Neira Ayuso <pablo@netfilter.org>","To":"Fernando Fernandez Mancera <fmancera@suse.de>","Cc":"netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,\n\tcoreteam@netfilter.org, fw@strlen.de, phil@nwl.cc","Subject":"Re: [PATCH 1/2 nf] netfilter: nfnetlink_osf: fix out-of-bounds read\n on option matching","Message-ID":"<aeM5TqWUHDo_Xjv0@chamomile>","References":"<20260417162057.3732-1-fmancera@suse.de>","Precedence":"bulk","X-Mailing-List":"netfilter-devel@vger.kernel.org","List-Id":"<netfilter-devel.vger.kernel.org>","List-Subscribe":"<mailto:netfilter-devel+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:netfilter-devel+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20260417162057.3732-1-fmancera@suse.de>"}}]