Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1890731rwb; Fri, 28 Jul 2023 17:27:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJQiUwz+UVxMvN2Aqma36rekYrNlZVuWzGjD8d5UlwWfagFkO+rbDp0LOliDt63FrHNixy X-Received: by 2002:a17:902:cec6:b0:1bb:df69:5e44 with SMTP id d6-20020a170902cec600b001bbdf695e44mr3253238plg.56.1690590460293; Fri, 28 Jul 2023 17:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690590460; cv=none; d=google.com; s=arc-20160816; b=nnwS48msTKVU3wX/OmmGzLakIg7StRGxF5HweTo5jpKE2Ys5EhfJm3D0Vk8P9+QLLX 63d/JvZH9Yf04gWj31Ky3p3xXqM1SkMdQS5ipbSs8XpoMKyObwC8cJgOQ31pVWJZzf1A 4fcQpUUWBNuL6v3qoBEcvl+jADZWJGhPW2BL+RdIWR8LiqYjFtPlLoeqUYNY1Qx3yH1d hRmCtASCHisWDsLU/ZU5Q7LHmNuNQnFRQyAS1C6wn5ycL9UaLtged3bp4d2r8idpmziu D5fS/PYq6+dBub31jOqR6ycAfJCghoGxcKwnyNdJSRyjC3QH1dPMi50dFJQpGfl3NynK fDEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :references:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=Vmm9PWjiIr44mtk0aK3RfwDQJ7qs4MHr/qIjINwktmM=; fh=p1m4B6Uwjbn2u2mHeu9+TzcCLJ3VbKxZEXIPp9LogdI=; b=U5OMVj7gmB61bhCKSEyuLj8KeV+QtRc8xp9u0QvYTBtv+XGzK7GLWh15j8bZZ2QAIc fAfu3/vlrN9wFVl0/lrlTjzxV9XBjdorlGqUsI1WYOjRLgXZCCe5L4RuX+Qap7bGopTR 1AzJEmGLbADEW4cQg7g5GqjLc0XJL22bU8LN6Oic2RWnIDWboBHNBU2amdISJyK9K38K vVf5VA+w6iRW0JJsPhqg+9lucQE4MFKGnOdy4lVQQoVJ8MngrG7sRH+jd2VLDDCmTVDr QtY2gDoOFCvUJF/Bki9l40lhADu9JzzLhEzc2RkbNpFWZNCa3+jnMj9+DbUw87UAs6gK QPAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dYK3bR4j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a170902da8900b001bbaa259eddsi3870778plx.356.2023.07.28.17.27.27; Fri, 28 Jul 2023 17:27:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dYK3bR4j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbjG1X55 (ORCPT + 99 others); Fri, 28 Jul 2023 19:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235708AbjG1X5z (ORCPT ); Fri, 28 Jul 2023 19:57:55 -0400 Received: from out-75.mta0.migadu.com (out-75.mta0.migadu.com [91.218.175.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B1B41BE8 for ; Fri, 28 Jul 2023 16:57:53 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690588670; 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=Vmm9PWjiIr44mtk0aK3RfwDQJ7qs4MHr/qIjINwktmM=; b=dYK3bR4jfVJXnzSRaMfZqtnW4gFU6mfQxSiBrWTH7pkmIsrNZe3P7OS3MRTRmLB2PV/QqV 9N2vHep1i4010Eypia8/71Gglslv0Pb7EADYRUDwiM4izode8w4ZvoKo877JOqYSLuQQp5 bC4NKn6bn4uBus7aXZze2rnixJxZLd4= Date: Fri, 28 Jul 2023 16:57:43 -0700 MIME-Version: 1.0 Subject: Re: [PATCH v2] bpf: Add length check for SK_DIAG_BPF_STORAGE_REQ_MAP_FD parsing Content-Language: en-US To: Paolo Abeni , Lin Ma References: <20230725023330.422856-1-linma@zju.edu.cn> Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, ast@kernel.org, martin.lau@kernel.org, yhs@fb.com, void@manifault.com, andrii@kernel.org, houtao1@huawei.com, inwardvessel@gmail.com, kuniyu@amazon.com, songliubraving@fb.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/27/23 12:34 AM, Paolo Abeni wrote: > On Tue, 2023-07-25 at 10:33 +0800, Lin Ma wrote: >> The nla_for_each_nested parsing in function bpf_sk_storage_diag_alloc >> does not check the length of the nested attribute. This can lead to an >> out-of-attribute read and allow a malformed nlattr (e.g., length 0) to >> be viewed as a 4 byte integer. >> >> This patch adds an additional check when the nlattr is getting counted. >> This makes sure the latter nla_get_u32 can access the attributes with >> the correct length. >> >> Fixes: 1ed4d92458a9 ("bpf: INET_DIAG support in bpf_sk_storage") >> Suggested-by: Jakub Kicinski >> Signed-off-by: Lin Ma > > I guess this should go via the ebpf tree, right? Setting the delegate > accordingly. Already applied to the bpf tree. Thanks. pw-bot seems not doing auto-reply for the bpf tree.