From nobody Sat Feb 7 21:20:26 2026 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (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 1808226ACC for ; Tue, 6 Jan 2026 15:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767714249; cv=none; b=ItbrxInIFC+4CRULmSuYlj/F91rbutgG02QIcOmfSet+nPsSMyNoM9KGtKRnu8Wsd05cBjLe2LVh/h/GaqYS1xUyghAKrKw2C3Nggo1jBInpl4ghjeQMlykHsDWF8xO2d3f1GY2GU7xoPm1D6cQVW9FFD+2vv5uZ0q2NjHkqFLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767714249; c=relaxed/simple; bh=j7Idr27nNfXYI2zInr9Cq657p3HHOeXfAqFTdKOF13I=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=B8NRHRBBJRFfqK86uz1epK90BvQCwaUGLYAwrKbw7Ug5E6eSzXrMLgSZxXHCysdZ4wIORkShAZ257l9k3zRzUAwj8n4q2CDgBVA+RUHXCsDJ1+hAePApTWEq4qzGWrxFPKX7rjUstyAj0Ogg8qIOefJOCVUJHX90dWU2ACJ5eDE= 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.72 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-f72.google.com with SMTP id 006d021491bc7-65d004d4e48so2636579eaf.3 for ; Tue, 06 Jan 2026 07:44:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767714245; x=1768319045; 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=f6f8y0BL/rpYqeLQ7qxFfYdUABylV70f14wr8qoRnsk=; b=YnNNtPqDvUvDHDKHdihT1UwGRkUuMGu8eL1PmsRdmd5z/UwAsnTZxK2/JN/5Q96KKs HvAUWyNWYV8IkC09RdsQCttDYjnskylrTvFgDPCHfYTl8MWpDJ7UdJrypAFqYXGmAh1s 4aAw4X6zTBTByTENTbL/3CB00RLqSlJ0CMMP3G108buKiLTsajJlw2Sz8tC0LdEOPftY Qlbj5YvF7PeRZO8q6H2d/z6soQPjTp8mz8s52o2gASKVZGd7QggZu1/+qbtPhj48fCfJ lk6ymzF+2zqso3B149AjkFLgUdkyNcBswMYQLAiYs6PxVsHHeIYj8jqZQ0lqKgzzH0TL v7Lw== X-Gm-Message-State: AOJu0Yz9qCtFLMvT4xOhPXlgfmBi1OmSU3zgp5p1K5bJihjMaI3Ra4rp EK9p+DwrYxLnhYJZjUyL3RC7tf95R8N4pFOr97ELUJH00cLfEE/rYA9ZWqKWXtKjlqdpd7Y5U/V bvyPDfZolQe8jFKtStX3mYtZEqXKRjQEk4wcLhecZNKbu3O2YGIpUCYBByWQ= X-Google-Smtp-Source: AGHT+IHVMIMyczt+Oa63Y9sPiCDP+4hb6bkoaA71kTjMMRk7q8+CiqqP/Y4XbUOKT7Av5wY3ddMjOhiKfk5iloGYQMq4vqatzTAw Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:1690:b0:657:4f2:97b2 with SMTP id 006d021491bc7-65f478c33e0mr2491310eaf.0.1767714245573; Tue, 06 Jan 2026 07:44:05 -0800 (PST) Date: Tue, 06 Jan 2026 07:44:05 -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: <695d2dc5.050a0220.1c677c.0345.GAE@google.com> Subject: Forwarded: [PATCH] bpf: Reject BPF_MAP_TYPE_INSN_ARRAY 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: Reject BPF_MAP_TYPE_INSN_ARRAY in check_reg_const_str= () Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master BPF_MAP_TYPE_INSN_ARRAY maps store instruction pointers in their ips array, not string data. The map_direct_value_addr callback for this map type returns the address of the ips array, which is not suitable for use as a constant string argument. When a BPF program passes a pointer to an insn_array map value as ARG_PTR_TO_CONST_STR (e.g., to bpf_snprintf), the verifier's null-termination check in check_reg_const_str() operates on the wrong memory region, and at runtime bpf_bprintf_prepare() can read out of bounds searching for a null terminator. Reject BPF_MAP_TYPE_INSN_ARRAY in check_reg_const_str() since this map type is not designed to hold string data. Reported-by: syzbot+2c29addf92581b410079@syzkaller.appspotmail.com Signed-off-by: Deepanshu Kartikey --- kernel/bpf/verifier.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index f0ca69f888fa..3135643d5695 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -9609,6 +9609,11 @@ static int check_reg_const_str(struct bpf_verifier_e= nv *env, if (reg->type !=3D PTR_TO_MAP_VALUE) return -EINVAL; =20 + if (map->map_type =3D=3D BPF_MAP_TYPE_INSN_ARRAY) { + verbose(env, "R%d points to insn_array map which cannot be used as const= string\n", regno); + return -EACCES; + } + if (!bpf_map_is_rdonly(map)) { verbose(env, "R%d does not point to a readonly map'\n", regno); return -EACCES; --=20 2.43.0