From nobody Sat Feb 7 23:23:12 2026 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (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 D69402853E0 for ; Tue, 6 Jan 2026 04:48:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767674909; cv=none; b=uoRiP6wMOZ3HPOzq7CZkYZYNAxCo5CpD+mrviMXOApyiBUerkosZtCuZ0GvnW/2+eicNhu9+Ni5+cD98cvV0XFY5YZDt881VckOy/olkb45OlD0/DVwB9ov4uRgOab49iomT3MbclW3HvWIQ+tCg48+0GVl+8bNFXrbONKUWqT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767674909; c=relaxed/simple; bh=OwCN2CdOwEiMkpfjjJZDZa/EclViL/2NUDH6SanWM7E=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=F85fLYIGvu+ZgZEFqufvops+5vhj4vLf8Cg0zHoOUjgABR2O8PF81MvFjV0aWrfXRvsje6QJt6VJooHkg5k0CX9ELAPfwJHOFtq8SxyadcXWsPLIWXjT9d4rCgQUTobQteRbJ7H092zrMx5VlFGjsyQ2mIbrUg/kb51jMPUK55E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-656b2edce07so1238783eaf.0 for ; Mon, 05 Jan 2026 20:48:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767674907; x=1768279707; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xOsje1nKlZ+XEBbdnD1yK//tiOvEbSN1pqHXT7OjXFQ=; b=oqmEpodSL1Q9bHd3Xq5db7sjOSF31b/KuBxwH38ZUvQq/Y23aVp8kLPMwaclXY5B0Q nVav/pLjunTvsjT6XWm8E7/zLnxKSMFhofT8lphNz6JRQsTkjBrk0WW9PtgQ+zU3C4C4 pLyDbTNH2rgSdAEIyMXDkN/ocSV02pi0twnT+AeeN2aJQMaMBtCxeNFmAqpW2ulzDbkT ojYLPmBjlTsLHOoZS4ugnFwuu6QEMiTKvjw6qAFSk76X2jgSlNGCgDXywSE1FmfRDhkn mtF8U7wz7/ATwNSaKhY9NcAwAIZD0AFVj6W6+JYPcM3Pd4cuFcCxq3uEbor4Q+t61WOg jjaA== X-Gm-Message-State: AOJu0Yx3aFvC5ANbSeD75P7Fq61WCal5e5Z5CDrinViklbRxHKCWQwpR q3LaFjx9xSz1DiEtS0AMJfv4p6USr7yNmFHoQzPHbpln4MD1jfUq8EcIekbISpvO1Ji18IIdDrs WC0OcVw3li4UHtwKXaJFDJx+3l3wVwV4mxtcCK2xgCsOLWzsITZuBK2kd+D4= X-Google-Smtp-Source: AGHT+IGSARzYit2a0HN6ttH2Dt20K8HX4fg/8skaZ5/Qx6IYFe6RgEm2k4SMTBSpC1b/LTCbQkgCgK4TP+5NZaOCtKl22orHo9g7 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:da56:0:b0:659:9a49:8f3f with SMTP id 006d021491bc7-65f47abe057mr818776eaf.80.1767674906838; Mon, 05 Jan 2026 20:48:26 -0800 (PST) Date: Mon, 05 Jan 2026 20:48:26 -0800 In-Reply-To: <695bc686.050a0220.1c677c.032f.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <695c941a.050a0220.1c677c.0337.GAE@google.com> Subject: Forwarded: [PATCH] bpf: Fix double offset in check_reg_const_str() From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] bpf: Fix double offset in check_reg_const_str() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master map_direct_value_addr() returns the address already offset by map_off, but check_reg_const_str() adds map_off again when calling strnchr(). This causes the null-termination check to read from the wrong address, potentially past the end of the map value buffer. This triggers a KASAN slab-out-of-bounds in strnchr() when a BPF program passes a PTR_TO_MAP_VALUE to a helper expecting ARG_PTR_TO_CONST_STR, as the verifier fails to properly validate the string is null-terminated within bounds. Remove the redundant offset addition since map_addr already points to the correct location. Reported-by: syzbot+2c29addf92581b410079@syzkaller.appspotmail.com Fixes: 0b51940729150 ("bpf: Factor out helper check_reg_const_str()") Signed-off-by: Deepanshu Kartikey --- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index f0ca69f888fa..b1cb501fb577 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -9638,7 +9638,7 @@ static int check_reg_const_str(struct bpf_verifier_en= v *env, } =20 str_ptr =3D (char *)(long)(map_addr); - if (!strnchr(str_ptr + map_off, map->value_size - map_off, 0)) { + if (!strnchr(str_ptr, map->value_size - map_off, 0)) { verbose(env, "string is not zero-terminated\n"); return -EINVAL; } --=20 2.43.0