Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1159632rwl; Wed, 5 Apr 2023 12:41:20 -0700 (PDT) X-Google-Smtp-Source: AKy350Y9N3zJ+bhghkyvhNt+Z+iAvlLtfHeHWrciXHP4gJPQl0aVcolWh20nmpTbU0TFGGNIxIcD X-Received: by 2002:a05:6a20:6aa5:b0:d9:4cc8:996b with SMTP id bi37-20020a056a206aa500b000d94cc8996bmr325843pzb.15.1680723679955; Wed, 05 Apr 2023 12:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680723679; cv=none; d=google.com; s=arc-20160816; b=WT0Tioeu5iw2mvg8zwFwFsbsWEC9vUJHhohEeZekpAkss05VqOqDB8X1aIg6vMHj37 xU6Lf8CU4gxzS1JGb6tjeYdBq8x3qVCdxttBRP4y0Lr/iDdZsEEU8nF7FkSUiDqf5S5O r4jIM4qv8cfe10EPvQRX07N8lBZo9stv2X2BU1O0073SbBV56u0ztmhImqVbErfPvuW0 SruYIDH7felX2B5DXpuxP3U9ue8FDZ0ubW40IbEinl8CUlZgt+SRvizGxwmIAsHjT7Ao ZE+X73U4o60E/cWIftvA/gt3+tRc3rm+q7NOlbJIFOyWRP3WnW3BRmiKHTJC7EuXSpHK s8YQ== 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 :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=Frao4MIUa9QmfySt08uJoD9P4bRv8oM72t8WzbutWUM=; b=WxDLdhC5WPPI2J6/zXFI9aci64xV65c/7g2oDxiERDc/uUzsxZbpEVwns+ViCzo+sN 5EREy/tqiZlaPvW7rNKUWeIPhF9omaVkNmgcena6Kviva5bGLTIP/fZ8zqhExB5wmv6S ljSlFvNbOchjf8K+EJkECvla0FYhChOLrRBboq5hRChKDdEPciQ7UJEIYpsbuvnRHvi/ Xz8wbetQrtomr7cB1gJiLK5CE8Lc/kCbxOPB3eBkLs7yOXKbSuoCkSxpgizlf3e+JPRR AQJCpqXxK7Xzu5J8Fgszm21UnEw/UNpYh0o9fY6KLQvL1cMtCJgq9jqa2u9/cuBeWLFs YiJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="LZIQZ/bj"; 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 v202-20020a6361d3000000b00513601ad3d0si5816251pgb.383.2023.04.05.12.41.07; Wed, 05 Apr 2023 12:41:19 -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="LZIQZ/bj"; 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 S233864AbjDETkd (ORCPT + 99 others); Wed, 5 Apr 2023 15:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232271AbjDETk3 (ORCPT ); Wed, 5 Apr 2023 15:40:29 -0400 Received: from out-18.mta1.migadu.com (out-18.mta1.migadu.com [95.215.58.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7308376A0 for ; Wed, 5 Apr 2023 12:40:05 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1680723534; 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=Frao4MIUa9QmfySt08uJoD9P4bRv8oM72t8WzbutWUM=; b=LZIQZ/bjypmz3jEsl53xilMeBc8YgL+90Ws8fG4BKba1/I26tuMu9JqWANc3SYv8W2e4+N lcrcfXl2A3g8qWqBh3QCDWEDOrcTrGi4pJB91D1RvAiE9sttQNyxOtX9nRRSRZZP2zT2ey nszvNq6wqqY3nycE/qhz4IiZNSIWTvs= Date: Wed, 5 Apr 2023 12:38:48 -0700 MIME-Version: 1.0 Subject: Re: [PATCH bpf] xsk: Fix unaligned descriptor validation Content-Language: en-US To: Magnus Karlsson , Kal Conley Cc: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Maxim Mikityanskiy , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230403143601.32168-1-kal.conley@dectris.com> 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=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 4/3/23 11:25 PM, Magnus Karlsson wrote: > On Mon, 3 Apr 2023 at 16:38, Kal Conley wrote: >> >> Make sure unaligned descriptors that straddle the end of the UMEM are >> considered invalid. Currently, descriptor validation is broken for >> zero-copy mode which only checks descriptors at page granularity. >> Descriptors that cross the end of the UMEM but not a page boundary may >> be therefore incorrectly considered valid. The check needs to happen >> before the page boundary and contiguity checks in >> xp_desc_crosses_non_contig_pg. Do this check in >> xp_unaligned_validate_desc instead like xp_check_unaligned already does. > > Thanks for catching this Kal. > > Acked-by: Magnus Karlsson Is this case covered by an existing test?