Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1326688rwd; Wed, 7 Jun 2023 14:39:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Fw2E2l7C79qDigWz2T+v27hfdBvXDKr8fSL/SObg4TM5BIFhWmKLeInnarEQsK+J6T8wP X-Received: by 2002:a05:6a20:918a:b0:102:a593:a17c with SMTP id v10-20020a056a20918a00b00102a593a17cmr378558pzd.0.1686173951348; Wed, 07 Jun 2023 14:39:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686173951; cv=pass; d=google.com; s=arc-20160816; b=wPtOTtyIJxzGvTgDGttH7BS9m2ao7OtqcHozyQq6kn3A5EA83zJbhy6o6U2QxN33Qu 4peBoPyeR0VespMo5yieARgxDAtQ3ZA3cYzo6UukR27TsZpIfcTno51isTxaNhw3nirA qN/y9+zPbvzqP3wWg7PF4iLEtqm5cb00GqePsCLAr+ZbrNUDZ2SEk8lf2Wy6K2g5eXB1 8b0AwMtffy/672PQajRp6kxG867pdDZkOITbH2NjkTrOpREIPydREphcOG1U5A+Cm4e1 2O2kUXGA9iccFVelfd1vKMYy7a6E4zabniH3dx/CLgRJHVDp2i9iIno3IQM36N2fRp3R e47g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=5/ao13F8CNYp1ZMCVek/NrMErWLjCVRsd7llF9n1i+4=; b=S93iRjVvHhH7cCW4UCyuIB2dJhJhl4hPctout0FmBm+SWYzdtX+cv2fTI3McAqSfoz vUYCsbCWufTY+nzPjY9XHZSmKgZfdktfS7y0qqtcuZqPOeWzh5X3tPDdm9SxhPpKefPI Nu5cw3Uvt7bwSmQJxIxAsRAsmZsFqP2Ph6so1oU5LcwO1p8fThseZ05BeHedlFLxSWZw zObeHsQdAo36l6LLdKRW9IGFsNEPbdv+P2Zwibc9QpTmxYNwbMORozYgHBc65QexgS3L PM+vveBO2qHrsMnTEG+oqKFoWkkniX9LWJ4ta5Ax8HXHFETs7ESlKNPo1qvRxlGY9MlC tT9g== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@templeofstupid.com header.s=dreamhost header.b=Ks06xLF7; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c194-20020a6335cb000000b0050f9b910fa1si9410837pga.368.2023.06.07.14.38.58; Wed, 07 Jun 2023 14:39:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@templeofstupid.com header.s=dreamhost header.b=Ks06xLF7; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236156AbjFGVFr (ORCPT + 99 others); Wed, 7 Jun 2023 17:05:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236251AbjFGVEh (ORCPT ); Wed, 7 Jun 2023 17:04:37 -0400 Received: from bee.birch.relay.mailchannels.net (bee.birch.relay.mailchannels.net [23.83.209.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A2E273C for ; Wed, 7 Jun 2023 14:04:18 -0700 (PDT) X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 38D9776180E for ; Wed, 7 Jun 2023 21:04:18 +0000 (UTC) Received: from pdx1-sub0-mail-a233.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C0B8176178E for ; Wed, 7 Jun 2023 21:04:17 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1686171857; a=rsa-sha256; cv=none; b=tojnCjr/6+eYNyelAoOvvsiaJ2iocYsvtz1cRKZxsf45Yytrs6wUme9Nd4TYFGxlZtXGJy uRlgbMVt27Ugmuhdy2lzcpEVbQpHrxXNQTgCjRp8iuFFUZPBaoI5Ev29zOUyvqPfU2uKvU o5FqnvB0SHD2GSQttNha5CFR0Kz3pt+/0gAKyBLD1M0aIFh3yhDdIYmkR+akioQj5jomYx WssFXipg8Ljit42Y4WB0GpLQaKrEi7MBEVfaTiPQbJ457IjgfBRQEfApZYVkd9N9sczza/ Se0eUkQkR7qvrqvAUo4maU/UEgqlcSHC8AaXU6dFF8M8fJ7oU5OxgRF/3r8IJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1686171857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=5/ao13F8CNYp1ZMCVek/NrMErWLjCVRsd7llF9n1i+4=; b=Vpy+cBFWQm6PZwMY4YAdy2Kj0SE2wCpwUyUgb/YCxFGo24JnIAxghn3PNUHluvMCu0WOPX 81p3u4Oizp9zA8ET6ata/E00xcEix735c0NNQHDtuyJDU3lRBfbqRBYO55Jq0sjjFLiEyn 8OPco3Q/XhKF05N8+xME3SRdKHraGDYzCZ3Q9ebC2xlmml0usIpkbSWxS3jNHQjGpnuvWR 82cN4OR2e9zLOtqKGjr0vxUJ800n9uPAH+FqWqAMrtBpxiKQWUhtvyJgk45854mdYgNGA2 o5QuwA8KDvXyidv1kif2Yr+s7dp1Aqq3ZfcQbzj/V8iqMSKXFhr73hFHWxW5Og== ARC-Authentication-Results: i=1; rspamd-6f5cfd578c-rzxxj; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@templeofstupid.com X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|kjlx@templeofstupid.com X-MailChannels-Auth-Id: dreamhost X-Fumbling-Left: 5585d2700cbc40c5_1686171858014_3778734404 X-MC-Loop-Signature: 1686171858014:754482429 X-MC-Ingress-Time: 1686171858014 Received: from pdx1-sub0-mail-a233.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.109.138.18 (trex/6.8.1); Wed, 07 Jun 2023 21:04:18 +0000 Received: from kmjvbox (c-73-93-64-36.hsd1.ca.comcast.net [73.93.64.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kjlx@templeofstupid.com) by pdx1-sub0-mail-a233.dreamhost.com (Postfix) with ESMTPSA id 4Qc0Fs1G5fzml for ; Wed, 7 Jun 2023 14:04:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=templeofstupid.com; s=dreamhost; t=1686171857; bh=5/ao13F8CNYp1ZMCVek/NrMErWLjCVRsd7llF9n1i+4=; h=Date:From:To:Cc:Subject:Content-Type; b=Ks06xLF7GgKn/OTiw8dmTQO8nej2Brz6p1ADLhr2dsBmEKI2DmGH2E2TYoyVG362f 6xxKjIH2WwcZo10JQ1hxEzYhUGIXIcK3Dp6Nl+m4Alm0omgGG4c49q22t1Obk0kDx6 B6Mik2b4H+v8QyYk1XKNohlCXlCbPSxsXri5V0PY= Received: from johansen (uid 1000) (envelope-from kjlx@templeofstupid.com) id e005f by kmjvbox (DragonFly Mail Agent v0.12); Wed, 07 Jun 2023 14:04:16 -0700 Date: Wed, 7 Jun 2023 14:04:16 -0700 From: Krister Johansen To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH bpf v2 0/2] bpf: fix NULL dereference during extable search Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Enclosed are a pair of patches for an oops that can occur if an exception is generated while a bpf subprogram is running. One of the bpf_prog_aux entries for the subprograms are missing an extable. This can lead to an exception that would otherwise be handled turning into a NULL pointer bug. The bulk of the change here is simply adding a pair of programs for the selftest. The proposed fix in this iteration is a 1-line change. These changes were tested via the verifier and progs selftests and no regressions were observed. Changes from v1: - Add a selftest (Feedback From Alexei Starovoitov) - Move to a 1-line verifier change instead of searching multiple extables Krister Johansen (2): Add a selftest for subprogram extables bpf: ensure main program has an extable kernel/bpf/verifier.c | 1 + .../bpf/prog_tests/subprogs_extable.c | 35 +++++++++ .../bpf/progs/test_subprogs_extable.c | 71 +++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/subprogs_extable.c create mode 100644 tools/testing/selftests/bpf/progs/test_subprogs_extable.c -- 2.25.1