From nobody Tue May 14 20:38:51 2024 X-Original-To: dev-commits-src-all@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 4Vf7Vg5CGcz5L03G; Tue, 14 May 2024 20:38:51 +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 4Vf7Vg48t3z4JYf; Tue, 14 May 2024 20:38:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715719131; 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=L1tl89Zho1ir7ViggzV5HyZTIAjGxho7JQmMy6AK9ug=; b=K1i0Y6wkuY4EmPIbNzfuDr/9vlkh5N0RdYBdgfmfyaagov92iWKabpBWUrh/G0xAAAXnmp pLGCwWnSn91SXIMFzYmSXfKuBlfpgtK9S5j46buVkU9A0joqiUjOGCEsKOQllQ7nADedXv r48b33tEjhE35JIr2Fhyjto27p20AtCyEcCss82KkL7Iykwgic5wbvxWKtENXo1RC6S9H5 0FoI5GY2JQBKADb/oaYcMrfL6lqXqP0IAxkoDEVUuYo7CsLgnZBl714J/YIdIksx6UQVv0 a4XltwLQ6gofkefg6f+KEOnWCpu4x/hefvlo33ZA2xcC1CtFFFAGGryGCGjZSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715719131; a=rsa-sha256; cv=none; b=cDTIIKoV9ZOERA2Hdm0XJ1Er8fXBM/Zycl8wa1UPUnQy2UxeS8BWUb4YZP+W226hs8LtSj LZupqjvb0SlofEZNumccrakzPwrEfvQx9tn4pKXJzJg1kMBbS2v023oi9VOs+k5GC7+JfK sg9nZO0w7CaT6fF9fHRMGP1aUeRXZ6sz/dWjwYCsSYwV99uQwW8KCZeeG+FhdtXpoZT+vd Fkw4ZovTPchha3G5TeFxLbqSQx0tKHE7u2xwdnk//tu502cVcBcrau59zNZ2eAZszdYCHe V01J2lmiP3lcZClzTkHsVrDwU0zoP1wvDTt4LI7w2OD08mF7vhLiXHjE8ansTw== 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=1715719131; 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=L1tl89Zho1ir7ViggzV5HyZTIAjGxho7JQmMy6AK9ug=; b=JkpqN0RgptZ5JSBu2z9nhGfR1i9W9dazv+d/TlIiuRqC/MJImPoPotDq1APZRZ+U05raCH D0ew2N4Hr/5nBlnMgGQZFViO12dh0ehfOYlaNR56VaLKtZjjNRPo43UpE6ojnVdLtxArh9 DeZp58xW35KYMBq0nKiX2nVRWx7H/2XBroNb3P10fDBST/Q7d8T0S+TAo4JpTn4xwccKsP z5IaqiwuFiCLKn8MoIVG6tHt5y1sTBD1vh0hgBrDBqq4J6fvQYHXiOVfzreamHBBGjnSKD dBdrQdzTcfxJAGETEcf+cCkCfrOG+e1cYyiWCmAJP9bEe522RP6dXzpnxLZgXQ== 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 4Vf7Vg3JNczmZQ; Tue, 14 May 2024 20:38:51 +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 44EKcpLA092213; Tue, 14 May 2024 20:38:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44EKcph7092210; Tue, 14 May 2024 20:38:51 GMT (envelope-from git) Date: Tue, 14 May 2024 20:38:51 GMT Message-Id: <202405142038.44EKcph7092210@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: e9927f4e6129 - stable/14 - fib_dxr: log malloc() failures. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/14 X-Git-Reftype: branch X-Git-Commit: e9927f4e6129271843985d994aab9edf7299aaa0 Auto-Submitted: auto-generated The branch stable/14 has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=e9927f4e6129271843985d994aab9edf7299aaa0 commit e9927f4e6129271843985d994aab9edf7299aaa0 Author: Marko Zec AuthorDate: 2024-05-06 18:21:55 +0000 Commit: Marko Zec CommitDate: 2024-05-14 20:31:10 +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); }