From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8992EC7619A for ; Wed, 5 Apr 2023 19:40:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233891AbjDETkd (ORCPT ); Wed, 5 Apr 2023 15:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232442AbjDETk3 (ORCPT ); Wed, 5 Apr 2023 15:40:29 -0400 Received: from out-37.mta1.migadu.com (out-37.mta1.migadu.com [95.215.58.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 731987D8A 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 Precedence: bulk List-ID: X-Mailing-List: netdev@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?