Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp699329rdb; Thu, 15 Feb 2024 12:33:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUinrY4HcpoOeNFJ37b5tv8i9PR1sw8AUY9arL1ROecjWyoXp0Oc04s0bPS51Fwn4lxtl/7Dr41tgR3AgLDRKTpFNafo/7sTtU5O01omg== X-Google-Smtp-Source: AGHT+IHopXkDlVkdqtCRAFpr0MDxXuWshlmd48tZyidkS2O/RU4pmsHry9lZS8hrRKEBZo04noQa X-Received: by 2002:aa7:d148:0:b0:563:c54e:f7 with SMTP id r8-20020aa7d148000000b00563c54e00f7mr1308994edo.17.1708029191110; Thu, 15 Feb 2024 12:33:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708029191; cv=pass; d=google.com; s=arc-20160816; b=XtIF3a44jPFA/bqGtIU7Q89kjn5MHt6sXcrvnukS/GXvz3bBv0BrOGaluj6gH8r3x5 Bwh6/xLERGbpTL6S4yBeZuAQmRGkwWdflk+nXZthJGnczyyQv/OJquuXzZAer0t8d707 8LMEk21vVlh+hoe4PO1BmF37CwGci0kc0tbz4L+dH/I11f1rQz/GgnQltfxxGQbPhzn4 o6RD8eMYijXe47RCrCVRqBtQVGuFhmiPWctJWSMdhoPvVTHpQzdh/yBGobJrxTY1TOyj 7BXgRDmeWHcxg/w50xbWgTxV9qjAZqc/E6NJiqCxcp4339LChGO0kdKgBotCDKUOUpZS VIig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=laSyg7YQPz643rzuuYEwb1CY2iHDVt99rko3X2hSnfw=; fh=MMPVUeSIk3I8ZGxH2BYBAgRe3bd5+SIQMinO8IeYKD8=; b=vqcGW1RQbK+8wL48IwjwCqb9bJMWaJpZOJZfO/sWHnbxJiJq+pwctyF7lNpNf/z/qv CIe2+fbvvWHq+I3AEII+szQdiqGRfwt/Br4QXUMWyPCYhANJN1toYKMvIf1S0O6JktGF hjIfemk6KffYLUNor5gfW8izz1Vh1UGNkWsOMhWvkrZnoJlXZ6rIqI6VbJ8qRk8p/JdV uAo7+qBCavtKDgJyAEaLP63Te8e3fGU5EyXh7tvx4FpJ+6YhiAPcwIn1zb8ZWad1e/78 ULylxdOb7qWW7GOUd9aJYWRhCwkeKOn/Fwxg/izF6ed0olOCNCLbrSWaMl4A4cGjav9F AA6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zCKnplUs; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-67655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h5-20020a50ed85000000b00562087c8461si966351edr.234.2024.02.15.12.33.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 12:33:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zCKnplUs; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-67655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D58EA1F23E10 for ; Thu, 15 Feb 2024 20:33:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA7CC13B292; Thu, 15 Feb 2024 20:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="zCKnplUs" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 5E8E71384BD for ; Thu, 15 Feb 2024 20:32:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708029180; cv=none; b=uKBl6Wt9DCKp1yhXyG0S7TSffiw/2Up67EPmBd+8jXRRcukwHIu8d5oFmP6QRseEMO2mvp/gfNUcPbRtZD8vnLLOiqJdlu00pazpY1HeY7BSr8reawT+vUv0y5NPUmdqCe+HR+lPtp9v/nk3IMVtjYUQyKNK1JrAoNcJgK+Y6BQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708029180; c=relaxed/simple; bh=laSyg7YQPz643rzuuYEwb1CY2iHDVt99rko3X2hSnfw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=focbs2YEtSqkjD3VMbvc2NwLTKNm70oH4DO6Z+0xuXZyipir7jTvmJngjhoihqDLtK1XI2Y6e20hit5GhPYJlWNIgplkPsL+r/HQF3g5RQAlsKRY7fXX5JQzF0iSSBmx0m+o0bbT1bK+NHe6wM0rGzC0Em+0DMGI/8WUFjEpDUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=zCKnplUs; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-563dd5bd382so3340a12.1 for ; Thu, 15 Feb 2024 12:32:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708029176; x=1708633976; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=laSyg7YQPz643rzuuYEwb1CY2iHDVt99rko3X2hSnfw=; b=zCKnplUsZl9cOHx1bsNhWVtlP0ATw6MpTM5BmPWs47sgpuz1ml51CDWFrlurYxwtRx eSDHVLvtnA4PEFRQG33cCHy9TvyulFK+pLb0GH9mNgEpYMIqxB68zrzN7vinbZDXHV2c 2mY1MrfELx7RacES7icTlZgorfIXoTKZLxFQB3zatHkdqpuNj9yJPcQnnKTUDFtBg677 MGIJvBzVyDBgKIy9YoPuUt0OPTGJzMKcJqxGaYd33+h8JzPTbRpIs5u3oEPTg7szDPFU xjkearPpOnufothrK+6gIik4YC4d8GwtFy9qCgApZNqk4omjgd2jLOFBsqRbeIQxLl6k K2gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708029176; x=1708633976; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=laSyg7YQPz643rzuuYEwb1CY2iHDVt99rko3X2hSnfw=; b=NIQNJ605+HCexpb5TmVy6pG0OdnCqRAM4vfymXmpabbKf2+q5oCO2aSD7hGAiEKKK3 94U/hbkAkG2UKKGowHgxdiwxTvYRC49knqv/p22LH3P8MbalEMHrZ6OTUeb1+ciJDMkV 2ncfmsGBkFjt9YANFTThTXJXd1v50ckuFvdxALRCN4zNHMhznOoZGJouVsMomA35vM58 HoiBifV5y6C76Ysex7SRkhKJtFsUZA9quUrEb8oQDBcPX35dUN/yUOUYQWBKyP1S/d0U 9vLkFuyMdBwxWvsjPfAOR3mzhDdcIT3aZddYqWIV8f9AGusxVqHhbT+OI1DtO+o8Xy2x uvyg== X-Forwarded-Encrypted: i=1; AJvYcCUNcdkO6LSLRcpTl8Xbnu7JkMwV3uhe8F8wnEfA+5Ak/fKJNiWDwUYCieqgCjMruvAIba1tIchqqFcI4rfH8o6aCdpOHNx8ZdNd+H5z X-Gm-Message-State: AOJu0YzvjNJE+lhsXGxJq+c8Uc0SYSA+rDDKUwvQnT7d2kFPox97ZcWU folwNsfeH0JxVsFQ6KIrM1vnL6T0pSqUVqg8dJ3KS1qqXq11h2p29XNg6/eNUQYvFM0vUqaBxla Ewlwcjc3/pfI3Lissz7Q5tFW3+YHAxDf8V3G2 X-Received: by 2002:a50:cd8c:0:b0:561:a93:49af with SMTP id p12-20020a50cd8c000000b005610a9349afmr44357edi.7.1708029176383; Thu, 15 Feb 2024 12:32:56 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240124101404.161655-1-kovalev@altlinux.org> <20240124101404.161655-2-kovalev@altlinux.org> <1144600e-52f1-4c1a-4854-c53e05af5b45@basealt.ru> <6cbbecf1-eba1-f3e1-259a-24df71f44785@basealt.ru> In-Reply-To: <6cbbecf1-eba1-f3e1-259a-24df71f44785@basealt.ru> From: Eric Dumazet Date: Thu, 15 Feb 2024 21:32:42 +0100 Message-ID: Subject: Re: [PATCH 1/1] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp() To: kovalev@altlinux.org Cc: pablo@netfilter.org, laforge@gnumonks.org, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, osmocom-net-gprs@lists.osmocom.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, nickel@altlinux.org, oficerovas@altlinux.org, dutyrok@altlinux.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 5:50=E2=80=AFPM wrote: > > 09.02.2024 22:21, Eric Dumazet wrote: > > > Maybe, but the patch is not good, I think I and Pablo gave feedback on = this ? > > > > Please trace __netlink_dump_start() content of control->module > > > > gtp_genl_family.module should be set, and we should get it. > > > > Otherwise, if the bug is in the core, we would need a dozen of 'work > > arounds because it is better than nothing' > > > > Thank you. > > Thanks. > > I tracked the moment when the __netlink_dump_start() function was > called, it turned out that in the gtp_init() initialization function > before registering pernet subsystem (gtp_net_ops), therefore, outdated > data is used, which leads to a crash. > > The documentation says that ops structure must be assigned before > registering a generic netlink family [1]. > > I have fixed and sent a new patch [2]. > > [1] > https://elixir.bootlin.com/linux/v6.8-rc4/source/net/netlink/genetlink.c#= L773 > > [2] > https://lore.kernel.org/netdev/20240214162733.34214-1-kovalev@altlinux.or= g/T/#u > Excellent detective work, thanks a lot !