Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp865702lqe; Sun, 7 Apr 2024 07:24:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNEhOoflRlzZDgsDjuRlWwSt0bTWV7RSfr6pkcfiCf+o8SGI/PXHXtgUl4kz17LimGbGM8SE/0VNwdFDBPu/sfuku2iRHqUzbYgasqMA== X-Google-Smtp-Source: AGHT+IEhZtQ+6/1seZjWhz8Zcn7N8mhk+K8g1j8wpGxJoIs+7/9X7SkGJULBJcPXZA2qNoEoK1w9 X-Received: by 2002:a17:90a:fb92:b0:2a2:da5a:85f6 with SMTP id cp18-20020a17090afb9200b002a2da5a85f6mr8693649pjb.6.1712499896100; Sun, 07 Apr 2024 07:24:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712499896; cv=pass; d=google.com; s=arc-20160816; b=r3ck5y0jJVh7Ncqn26KREwaLKMKjkwk8P5aX2C4PYZq7HlwGo8f9Y6hSvIycNxKUhN /e+pAMY9pAeenWSNk6e4Zh4t4OpRflzUhFwAuFAUyPeRczJc2Pge7lYWjGNg5DHJNCJ0 WZtdelRy/EM+aBRQeGmC0F6IfdWFDAImu1UKKxM+4NRx/fl3WvPXn6zZUqTEgOwZB4CG /bV8R3zVl0l6jZK/6GJQzGpN3nE8K/q+uh2mJj/ZlHZdkJWQjXcj9cxM4o4Faw80rr6E Hhr17Yqk+XWEg5VE8ME4NGVCvGdOW8tGeg3bWHTthE+GmsflOWvSF4bjQ+yqatjkzhHI 6wXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ZJYGJMn0SoZv7X1gCRhWkduuUEvK/yiFWdRu8bhp/fI=; fh=5m6/El0CW0RABdHUECfKdgMBim3OsicONYyAsHQskRU=; b=xi9idu/h9BAxlzqylY/sO3YPWWgWTINsk+jo3QvqynoX1ngk99MVdimkuPSWP49SQK zmHGQxgMPyagUgg4WguqDkEc17ss0wiP463x2dE7Z1Pz/uMXkeI4WMYaf9xbKjBleRnQ a8k8uwR3+bnmPaQ7MXNizcvcJN7S4rJNhxeHoRiHZgoK7+6ZspwrvAeRGqvHMScHc/aT 2UgqH30OkUsqDAFeTB2vJ2C/ZaELMqxbsqrZV+rpiE/1nEUQ3QsEpf6vn9Tf3HvEORvK PaD4QAxPRAP+G53Yweu/9oY6d+5pw4EO9R08i5/aUlz/fjc2RK8dBdj+7nCJ3JtLQoUj xqSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BNx4sn9d; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-134521-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s2-20020a17090aad8200b002a2a7ed8280si4739693pjq.25.2024.04.07.07.24.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Apr 2024 07:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134521-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=@gmail.com header.s=20230601 header.b=BNx4sn9d; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-134521-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 B8F6A281979 for ; Sun, 7 Apr 2024 14:24:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9203738F9A; Sun, 7 Apr 2024 14:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BNx4sn9d" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.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 2627737703; Sun, 7 Apr 2024 14:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712499880; cv=none; b=sKCzdpfTg9Fm7AZ1gsjb9/MzCSPapNPjYz/Qb1UQWyko742wyuy2VhiaTE915CEGf/JJNL5HlvBl+a3vpOUX6nNoD/pApLxgBWSpytoZby5oXb97xNlUj2M/BMpF5QC+iaKvPn3Fr2TqH8p5CWEKqtPVPgrI7KxfVMY76pP2jDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712499880; c=relaxed/simple; bh=057EjmkWBMVcK9xKGnWCFqyiyABAvqqe5E02u7dyYAg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=sUx72VSBWx/O3yqeQyqLjIpyBVx+cNwNfgnoeVhsICVZSjNzIwW8JUyZB8gu5Zml5wuDmt4faiXHbXBAneMVPCfkFnV41iewUp+0vBhG8iExggr1Hxmsjgmb1aBm70tZJ5b4zHRojnwbekxe2k/TF3PZTs2Z9tB5vHQ1lA0qDy4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BNx4sn9d; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4156c4fe401so23403795e9.1; Sun, 07 Apr 2024 07:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712499877; x=1713104677; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZJYGJMn0SoZv7X1gCRhWkduuUEvK/yiFWdRu8bhp/fI=; b=BNx4sn9dBzxsu9zaOZGT88a9vflbpVGiWMSHAkCZAMMWf9JjsgqYxqDrd9c/TP0rdC 9Wf2o+wWcNk5Qz9MCuQjYYxQWNK2FAgengeJDRfJwuwffM9W6K8VYY0mHHpFwHQj+jdT tMFjYnmt+tvSvvMj/Ks9M539ST48zTExvyidlu7Ukrgoaj2x3SOzZYzzRFppSU2zKFIn OTflMTzD9unSukT2MLH+9rsrKmLbynS4HrTzKLnW6XdSY3AYvretlDgdGeulMcjI66mr gkZS1kKyWYf2JwbLdeirxpOTtcRgK1kn2NrfeGGFd3rrobPpbp7q/LnvZ7R00ecgLGmK c2Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712499877; x=1713104677; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZJYGJMn0SoZv7X1gCRhWkduuUEvK/yiFWdRu8bhp/fI=; b=xAAWtVaWtW1B2Osp4Z0TtUbQbEnJvOIdfeLGRBJF1jpBBeNZS5DSLnxxM5wM0RbRLO Y5CSCgRj34ExUzwpVsWYNWjT6Mr5WYqCMTAMMfLrV5y/Ldi5SEaxyiey1Pg9dIv8I3RJ cc867balHjR7YaRqffFm6ZT6TFq82O/aisk7jOxnZQUF59J3vQADxrTTTwhs1uLSgxqc f/q4KesOTZ5+m7wigkh/5Xq14CW9f9s8TIUM/ZG1yWggxSeuHewotXa6gyrWBIsLCZCX sf3q3MWUSoYfJ6fErVqoaw9OnNH7oz8R6mnd1LJ0osuonPCA5ToJS3BawGrKGDb/ykix os6A== X-Forwarded-Encrypted: i=1; AJvYcCVS4Q093Y1HRhs7QXuxxihklz467xkSffKd8TaHmIqxUiM1hBmbkom15UtG3hXbhDZCereFf3EcpPXyDzaUKD/11PorNUFKEmseK7KD9wl8iIRsSgVWpiAoNDTtbIYM+S27q8W4IhCeK9Ouh2VzMFvGRz3q/r+A2T2d X-Gm-Message-State: AOJu0Yyj937tc/45ct0UKzVikI/0yC1Hd4D3zjxHceKFkaBaTw2nM0rA vp1obCcIhh0t59dkTnC4yEUiSZy7/xYAF1p+Vgd1cOrV69nW3N8jElTU5FlxMhIziSzbA7zT0BO V7cxW2eKlUXu73Zp7XLRIpR3dA3U= X-Received: by 2002:a05:600c:34cb:b0:416:5192:a30 with SMTP id d11-20020a05600c34cb00b0041651920a30mr1649236wmq.3.1712499877213; Sun, 07 Apr 2024 07:24:37 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <000000000000b97fba06156dc57b@google.com> In-Reply-To: From: Alexei Starovoitov Date: Sun, 7 Apr 2024 07:24:25 -0700 Message-ID: Subject: Re: [syzbot] [bpf?] KASAN: stack-out-of-bounds Read in hash To: Hou Tao Cc: syzbot , bpf , syzkaller-bugs , Network Development , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Eddy Z , Hao Luo , John Fastabend , KP Singh , Jiri Olsa , Martin KaFai Lau , Stanislav Fomichev , Song Liu , Yonghong Song , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Apr 7, 2024 at 2:09=E2=80=AFAM Hou Tao wro= te: > > Hi, > > On 4/6/2024 9:44 PM, syzbot wrote: > > Hello, > > > > syzbot found the following issue on: > > > > HEAD commit: 443574b03387 riscv, bpf: Fix kfunc parameters incompati= bil.. > > git tree: bpf > > console+strace: https://syzkaller.appspot.com/x/log.txt?x=3D148ad855180= 000 > > kernel config: https://syzkaller.appspot.com/x/.config?x=3D6fb1be60a19= 3d440 > > dashboard link: https://syzkaller.appspot.com/bug?extid=3D9459b5d7fab77= 4cf182f > > compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for D= ebian) 2.40 > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=3D13d867951= 80000 > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=3D143eff76180= 000 > > According to the reproducer, it passes a big value_size (0xfffffe00) > when creating bloom filter map. The big value_size bypasses the check in > check_stack_access_within_bounds(). I think a proper fix needs to add > these following two checks: > (1) in check_stack_access_within_bounds() add check for negative > access_size > (2) in bloom_map_alloc() limit the max value of bloom_map_alloc(). > > Will post a patch to fix the syzbot report. Will also check whether or > not there are similar problems for other bpf maps. Isn't it fixed by https://lore.kernel.org/all/20240327024245.318299-2-andreimatei1@gmail.com/