From mboxrd@z Thu Jan 1 00:00:00 1970 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 CAAD267E77 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=1709306973; cv=none; b=Sgp1aQoiNqr+WaiK13ANFwGg+CMQkEUlJV0MbFwYlfC200E3BUwiLuBSksmkPSLzitQFfHygX0mfTzACYj2Y/oWB4rxVLqrWZJ5JDg/34b6yvkPl1P2XovUZBvpaa+G3ceq9U2yKkLPDvKQKgy/CcDmR7RsAUXnWPtmG7XzYNhc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709306973; 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=XaaomZuQmo/E3rQHmaZoEFLwZzI0knOhXeGCmVo12q7JNGQSrmoqapcoSqG1JM2trsr+XBBwsmwwPw9xbspCTsmHrRaPvNs7v3IKTuscDA5z+e8NXIRKbDB9/oTMwQlFWh7qJlEnLOwKf+2vSdAks7TdydJ59D8o52Mif2fvP0g= 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 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: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-56648955ac5so3174419a12.3 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=Meb6xXs7EGpS2N6rzF4ap0rNHmQC+V+VzxBjsY9jiI9qXxTqwGyfOL/I/t8ZIzCtjm ckAF2Af+xwgIvLSGqm7AbWEmyhQ1+OEn00JFCWBzFKZCedWr5/JxISV2PObBCbihRSqN Xxpn9Rhjnq5STVubkY9DZmvwALNGtMTY3ZAvCUV5HJAHLAtyLvLDS1KXXE21CwQn8c0h uMlLPbVlrlMNd/aMsOYTNoI4wVNoNy6gnzONckDkiNcZU1kdjb1WVIS4JasUZdJP5zeQ TNDpQJMF1mxWrOEiA4bYGO9qtHxvr7A5tfuo2ir2K1fARYah60oGzw7oEFvTxFspZTEe 2YdQ== X-Forwarded-Encrypted: i=1; AJvYcCVE07btaPpUM606wMTnC9DisDost2DatkdIWoZQFxEBpKsp8D6V7L3vyfVVdPG5+4aseNBcgqzlfOyAPhLJLUESKq+LG0SD X-Gm-Message-State: AOJu0Yx8bzU479P5k1x9YfiQtcfc5DuHPS9/T05P3NBNvmwauPDrTdyX 3+edLN+h75NG4LUavmpQoLP8ZFG/n9kN83T9fiLkhsVVwU3TOhikh05vgbcSrag= X-Google-Smtp-Source: AGHT+IGXmTvmpDOBogei2NKEGeBxe8GHXKdXl6gK0nD5jHjKOOE0e/RY97L7Ob9/n6gWA62fsQQ0Ug== 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: netdev@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...