Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp1213970rbe; Fri, 1 Mar 2024 07:29:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWktDq/03guobhrelUOj5KDg+y2MiPfeQoCkZx6+3bfncr+Z6Xii88fWpSg36l6qoDjxoCPv+9dWJwmMSGKmfe2bOf0NyeTflmsLHNNOg== X-Google-Smtp-Source: AGHT+IG7RQA7VeyctahY5In4v0UXLLdy44RedE2hmvI479++YZm0dF4esMAhm5EG4Obrvo/ODJfz X-Received: by 2002:a17:902:fc47:b0:1dc:b6ef:e237 with SMTP id me7-20020a170902fc4700b001dcb6efe237mr2863540plb.31.1709306981447; Fri, 01 Mar 2024 07:29:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709306981; cv=pass; d=google.com; s=arc-20160816; b=X7Jm9k681TCsiYb6J2S3sF0UwsOCJ4BP/6ChCdSiKw7k1GFTMhb+PYyRS1sB/RvCsc h+4J5Xod1nFxc+5lN5fMpF+lbe9T4r2wI0WyJus3b9pcpVHcm+nuCdD8ez/1LwlwOyV+ 0jUDZo2UjdfFRMoYhQCi0LghwV8a+4eB15HVSPC+rFZ/PWmoFbQk4ZFv1PtqUFGCLDGc tAsCNe+tmA1t7uEVT5wJiDjod+iPNUJSkkH8y2ueaPW3dABDwqZ+1JZDI80485CrTkUy ui9zI500iaudM0g5IlB2FfJ+HBZKXS4OUob76sPadeC3eYd0Nk7+Pf2zj2fO1x6ZpcVx rLsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2MZ2yOTO+KIB8siKuGMOdBUlhOc6wSKQHzvOaxRX3JU=; fh=xpt+zM0z7txiJdhjmJrxhkAf4/Jlsy58nQFhq2KjfpI=; b=PxJER9WOunADjRfV7f0eaTmPcl5LZXiI0/izZzhvfMpxbyET7IKH94XEO61hPkTPLc uhlGWZ870Y4kRxyZyglthmDMaTu8QQcWZnZtCZeYtxI0lQ7cPN4xY7LmRqizFpI+Uv3l 4hmjPWEyCAaMLWfbMT+e6Iwu6Jjgzd89H1FgDdBTKVcEW8yGn+/XQMv2XhABl8xflTw2 kRAUBcSqzCowWpZXLvNb3co+0G2/vl+r0DkfoorYHUl4ABb8SrOwJsy/lgAA11muP+K3 8Kkq1ImMgSiNEjfiLm54/Yoc/8x3tRisPyKqAJNR9mh77rSyP9PcNJYrdqhhytQX9TEL 28WA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@resnulli-us.20230601.gappssmtp.com header.s=20230601 header.b="y/Ct6uB6"; arc=pass (i=1 dkim=pass dkdomain=resnulli-us.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-88622-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88622-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i2-20020a170902eb4200b001dc91f97b58si3431409pli.652.2024.03.01.07.29.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 07:29:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88622-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@resnulli-us.20230601.gappssmtp.com header.s=20230601 header.b="y/Ct6uB6"; arc=pass (i=1 dkim=pass dkdomain=resnulli-us.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-88622-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88622-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2A66B28783A for ; Fri, 1 Mar 2024 15:29:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B0636F06F; Fri, 1 Mar 2024 15:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b="y/Ct6uB6" Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 CAB156E5EB for ; Fri, 1 Mar 2024 15:29:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709306972; cv=none; b=EQpsNdroYS24XwuFZTUNnDPStxHNhTEm0zVsVtkc6UADNy7KIYZEn/kg8PXpzURQs5bAO7LOitlGluluyt8niMGqmzDqQhVhR5EmmvgldtdZARsDmy3FHzyhmZBXs+jDU7a8pqGTpq9pXrUbx5hgniX+GuWhtMi519Eyja6tdvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709306972; c=relaxed/simple; bh=UpbU7hO7PgZpThGtfOUVUaIkjG5Jg/+Nv9/mNDW/57U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=vEiaiZCONAzBywO4wBBMHqZg7H9oOKkh2CprW9qUO3ZG2yf/131vxa20sfzj6RnB7GFbecKlVrLPgad7h5oBD+SzJ3zWdy2iXyZLTthBA/5i1ApO1GNFOPOAGSUSfc8/HFSGtYGqVvmUR5TEQus1tidB1prDIeT33immQHhs3Q4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us; spf=none smtp.mailfrom=resnulli.us; dkim=pass (2048-bit key) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b=y/Ct6uB6; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=resnulli.us Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5658082d2c4so3368859a12.1 for ; Fri, 01 Mar 2024 07:29:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20230601.gappssmtp.com; s=20230601; t=1709306969; x=1709911769; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=2MZ2yOTO+KIB8siKuGMOdBUlhOc6wSKQHzvOaxRX3JU=; b=y/Ct6uB6QO5j8G6f2bPb6YwNXYIzuJNLWxoeYPlpjHNrmJoc8ZuHRhN3bSkCNL795m P38GwsgUAQbhhD9JkicHvT37H3ApLU/Ngu9lnJb+N7pp8BNuFygp0+Pm6/cHLcqE/bsZ 2h7sRgnY3Rxu2Kfb8gmvn2LhfCPr8QDAoL/qPW/lxA5XRecYBJc+o7TIG5T1qH9Q/7Ph 87XUT2jtjyOUrptYcLxBTv9pTON441DGM0ktxZnfH22BRlWpwycU6JKkz7WHj1UdktLx 6ISJLRK5K+fhwYarQKLptGwxg3bVXaSCl9zT/XGXXil/n5DtoidfuVgm99yU1Jv8yh2w iR/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709306969; x=1709911769; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2MZ2yOTO+KIB8siKuGMOdBUlhOc6wSKQHzvOaxRX3JU=; b=dzHQ8nG4NzzwyFykSQ4Pgli/94i7novScZRYORMV/Jn28OgrPKvWRynsJB8HmsNX9n ew9rw0GUclkp/H9gPSV0zhsgsBIAbL58tMXCrinHo4djHHPe3D7wJRVwC2LSG1ddo+Tu jg2A5sBBYLpRO1zVap50IN/YKSH4HKkK9u7PSL7itu7R92ooSMKs3Onm5NPSHMSIKJw7 EdKBVVLJ350AnU13EitlGnpSTO/HwR3o3DLE+BHLZ3dVTHjPK/nC8srbMdEk7MTh3vOb dgECTZKvlrAdP24hc59qrq8O+6+0eD3bgqhMKbwFTHEKt/uwJtqrhJfd97RiFAHEGHqY NK6g== X-Forwarded-Encrypted: i=1; AJvYcCUuesGY/rOrsLedfoOxQSAifD/nKjQ2abaGU1W0/VmdeS4fw65b62vY54i96c5irZajKbxTqmV1GfJy7F2Q5cXVYVp2e5Yacs2SGFVh X-Gm-Message-State: AOJu0YzOMMU4Td3XTMfV1NKeSRho4EXyVKCHuA6YtqO0NxVw4AwMcUVQ LGoAxDH1ca+RNVyGc6sdtxwwXOTvTlhWhsWLZJmifZS6C87AMgWA8mYQIGt5ElA= X-Received: by 2002:a05:6402:3493:b0:566:f67e:3f72 with SMTP id v19-20020a056402349300b00566f67e3f72mr131359edc.12.1709306969059; Fri, 01 Mar 2024 07:29:29 -0800 (PST) Received: from localhost ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id fe1-20020a056402390100b00566a1b8614esm1579691edb.58.2024.03.01.07.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 07:29:28 -0800 (PST) Date: Fri, 1 Mar 2024 16:29:25 +0100 From: Jiri Pirko To: Lena Wang =?utf-8?B?KOeOi+WonCk=?= Cc: "fw@strlen.de" , "davem@davemloft.net" , "pablo@netfilter.org" , "kadlec@netfilter.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "netfilter-devel@vger.kernel.org" Subject: Re: [PATCH net v2] netfilter: Add protection for bmp length out of range Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Fri, Mar 01, 2024 at 04:12:24PM CET, Lena.Wang@mediatek.com wrote: >From: Lena Wang > >UBSAN load reports an exception of BRK#5515 SHIFT_ISSUE:Bitwise shifts >that are out of bounds for their data type. > >vmlinux get_bitmap(b=75) + 712 > >vmlinux decode_seq(bs=0xFFFFFFD008037000, f=0xFFFFFFD008037018, >level=134443100) + 1956 > >vmlinux decode_choice(base=0xFFFFFFD0080370F0, level=23843636) + 1216 > >vmlinux decode_seq(f=0xFFFFFFD0080371A8, level=134443500) + 812 > >vmlinux decode_choice(base=0xFFFFFFD008037280, level=0) + 1216 > >vmlinux DecodeRasMessage() + 304 > >vmlinux ras_help() + 684 > >vmlinux nf_confirm() + 188 > > >Due to abnormal data in skb->data, the extension bitmap length >exceeds 32 when decoding ras message. Then get_bitmap uses the >length to make a shift operation. It will change into negative >after several loop. > >UBSAN load can detect a negative shift as an undefined behaviour >and reports an exception. > >So we should add the protection to avoid the length exceeding 32. >If it exceeds it will return out of range error and stop decoding >ras message. > >Signed-off-by: Lena Wang Missing "Fixes" tag, again...