From nobody Tue May 14 20:39:26 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vf7WM1rfSz5L05K; Tue, 14 May 2024 20:39:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vf7WL6rBSz4Ksm; Tue, 14 May 2024 20:39:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715719167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q4xc841hT3BVjKGDra33JVVm287NwbnaQPWxFEXPE6w=; b=nggHT5Rhn5UIbnAmOdkkwZD7L9pFlvSxsgHS4jS2FfiLduWWKHInr7Y7oQvpkjf3w8n9sM H1w/vaNgrQmqaVJaxfYoNbR1AkS5P51cA/mCUbGaFbRMU7AcgRxZZxQHEYfMhoukKiSBtI tf5EhPNGiOG/jVC8OWBv993g9M8jO2cFwr8J6Aazo9IbXmefh9YNq5wUc9NYdZ43Ilodog 7i4l4nIWAtVFhf/6SjiyGixxfx49+hWfOAjuRSxtNInzCZHA+9TKkRI07F/GVVnjTLVxlY F7kyGJMsY5VbpE7wtQ46Qai+AHOynIBref794Rf9IAZlVWbXQ9X9+k84rP79PQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715719167; a=rsa-sha256; cv=none; b=vhTQcqLmEmjizdsDPBoH8ksRR1/WKuivkSPPDMh0enWrT0yUPEhwXA4GqLbuv52nPDq5fR GA5PEt3mCAjpQInImRsTD+4x2DOVxkHKJ1TKppjGfKsadgqwXEPOLfYJuBFgfINNDKvmF2 3dx6ctSN2zLgZR2zpTCT90gAzgYeENZ4DEyUl9XXWJb2K9vQOJwtLMT7TviALPa6YMYyca pdmMqnzaLkr3rqEH9L2ML/uM+RDKSaG713pY7byxTlTkeoxCQk0LhIzfw77syIWnt3GnNX PvFjIXYCNkzaryL+Uf5++meJYio4X6PrvK+wK2ksnA/cfiTCSboPJ5JlRn6+hQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715719167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q4xc841hT3BVjKGDra33JVVm287NwbnaQPWxFEXPE6w=; b=UeYB1JBRXgvYAuVMYqorj9zDnz6iwDnPFes/Ota5EaWiLbkMiP1XsVeRR9Fz6F3GAeiT2X W8HZxvNtN4BDaDYpe2Bwp+AOTOmZPdYXwCbph9nGPlEZ4ep3zYboHcQYdSg7v80Vy6XXfU qmIrpw/4VDDDRe/YreR8K+gBaiAFkTIuTqEWoYDQ7XuAaTCSP7oBhQ/OuopccxQLwmRVAr XSUU6go/r+BQH6Zgp8QGXi/BRmgmjYkzzjuqAI9JehAeXihOQTEATnD0n0idcL6u3x4lFg AtNcXSZ51FLKzwAnVkWi1achDxFg2YZj6lDjNQZv7HQxdW+jK1GqYVAZ5TYP/g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vf7WL6QkrzmCp; Tue, 14 May 2024 20:39:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44EKdQoT092785; Tue, 14 May 2024 20:39:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44EKdQgX092782; Tue, 14 May 2024 20:39:26 GMT (envelope-from git) Date: Tue, 14 May 2024 20:39:26 GMT Message-Id: <202405142039.44EKdQgX092782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marko Zec Subject: git: 416679ecabd6 - stable/13 - fib_dxr: log malloc() failures. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 416679ecabd6c73ee5cd700367347133ae15f37c Auto-Submitted: auto-generated The branch stable/13 has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=416679ecabd6c73ee5cd700367347133ae15f37c commit 416679ecabd6c73ee5cd700367347133ae15f37c Author: Marko Zec AuthorDate: 2024-05-06 18:21:55 +0000 Commit: Marko Zec CommitDate: 2024-05-14 20:35:09 +0000 fib_dxr: log malloc() failures. MFC after: 1 week --- sys/netinet/in_fib_dxr.c | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index e7eede53ea51..db4f4a537e22 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -1118,8 +1118,10 @@ dxr_init(uint32_t fibnum, struct fib_data *fd, void *old_data, void **data) struct dxr *dxr; dxr = malloc(sizeof(*dxr), M_DXRAUX, M_NOWAIT); - if (dxr == NULL) + if (dxr == NULL) { + FIB_PRINTF(LOG_NOTICE, fd, "Unable to allocate DXR struct"); return (FLM_REBUILD); + } /* Check whether we may reuse the old auxiliary structures */ if (old_dxr != NULL && old_dxr->aux != NULL) { @@ -1213,16 +1215,41 @@ dxr_dump_end(void *data, struct fib_dp *dp) dxr_build(dxr); da = dxr->aux; - if (da == NULL) + if (da == NULL) { + /* malloc(, M_DXRAUX, M_NOWAIT) failed, retry later */ + FIB_PRINTF(LOG_NOTICE, dxr->fd, + "Unable to allocate DXR aux struct"); return (FLM_REBUILD); + } - /* Structural limit exceeded, hard error */ - if (da->rtbl_top >= BASE_MAX) + if (da->range_tbl == NULL) { + /* malloc(, M_DXRAUX, M_NOWAIT) failed, retry later */ + FIB_PRINTF(LOG_NOTICE, dxr->fd, + "Unable to allocate DXR range table"); + return (FLM_REBUILD); + } + +#ifdef DXR2 + if (da->x_tbl == NULL) { + /* malloc(, M_DXRAUX, M_NOWAIT) failed, retry later */ + FIB_PRINTF(LOG_NOTICE, dxr->fd, + "Unable to allocate DXR extension table"); + return (FLM_REBUILD); + } +#endif + + if (da->rtbl_top >= BASE_MAX) { + /* Structural limit exceeded, hard error */ + FIB_PRINTF(LOG_ERR, dxr->fd, "DXR structural limit exceeded"); return (FLM_ERROR); + } - /* A malloc(,, M_NOWAIT) failed somewhere, retry later */ - if (dxr->d == NULL) + if (dxr->d == NULL) { + /* malloc(, M_DXRLPM, M_NOWAIT) failed, retry later */ + FIB_PRINTF(LOG_NOTICE, dxr->fd, + "Unable to allocate DXR lookup table"); return (FLM_REBUILD); + } dp->f = choose_lookup_fn(da); dp->arg = dxr; @@ -1311,13 +1338,17 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q, /* Structural limit exceeded, hard error */ if (da->rtbl_top >= BASE_MAX) { + /* Structural limit exceeded, hard error */ dxr_destroy(new_dxr); + FIB_PRINTF(LOG_ERR, dxr->fd, "DXR structural limit exceeded"); return (FLM_ERROR); } - /* A malloc(,, M_NOWAIT) failed somewhere, retry later */ if (new_dxr->d == NULL) { + /* malloc(, M_DXRLPM, M_NOWAIT) failed, retry later */ dxr_destroy(new_dxr); + FIB_PRINTF(LOG_NOTICE, dxr->fd, + "Unable to allocate DXR lookup table"); return (FLM_REBUILD); }