From nobody Mon May 06 18:23:48 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 4VY8tX418tz5J1rZ; Mon, 06 May 2024 18:23:48 +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 4VY8tX3VrHz4r8k; Mon, 6 May 2024 18:23:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715019828; 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=3mSKdmONorKQiyE+svsdDVxLwhgpywAbyWLQis1YCe8=; b=HNgEmqRofgdNHkVqhMrpHIZkXoNcdz6wsKz71G/EEs+g0JBBVGG97x1WsQaeQpaTOyuTof yJ6oRZBPhevYQOSlKlkAnfKyD3cMNPoTYUL1v2FKd4oJ5Z4gOmVvzDc8cbGPZGjyHwsUFi fzMWkj/B0AjnydtUiac81SfVYz3noU9n+gU14OH7V8lGKSaBv/MQp3Eqtoh6RFtKL05CAr 3O9UTuLctgZp2CrViNwj6vIhx89Jr0mrIV7BDm+270u42NxGXzo/yj3m8nYBc/pMqQVziC x4Gu3PftpKKH+N7d8leTgUOjFtyGIe3qJ025hB8jVIkwyCcShCVBe5Tn0RetgQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715019828; a=rsa-sha256; cv=none; b=leQ6sLT2zFLOSwSlhR0QpFK0aa/b3q62RP32jXWm/judVuYNt+5Dx3UoU9a0nu2AqyLiiE eqC04KnLgrg9urpcoqEtJugvZuDoQR+ujqxRE0Jv1nPCRUj8s204nM26EOpt7iQ+52XJsb byHt7EDfjjZhMEVjIoWqRj9cypMcDRWiGOO31MuQZ1XVR3UvRjAxjCniLv0uHUimWxxaUb 6UeLVBMrJW/qDVlbJvBx6Ce9f9+WuXvf9tRKX3aox4oLUXaXNAobc5fkM6UNcBVkl5K1Qs kaTymbmk93m7VsEJgbUb/QM6WHHW2kztNAJvWVYJZGEeqBhbJAwOqd02C9OXdA== 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=1715019828; 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=3mSKdmONorKQiyE+svsdDVxLwhgpywAbyWLQis1YCe8=; b=uoag45EfH1jr5qkaSRw5yxKshqnWMdYunnxYOuoUVU8wB4EcG6N+0KPg7dpOimehS210eq vMzMdJF+RPRgvFYXhnGvz2K++bBZ4V6Co++/LZ/5Wtn2yh4YBztdw8Z/EedX9W32qepGc5 aVK5yW+rjZKn4Ym6PqZXPEb0XxLAtuz5Vi5NeS05XwibjwUZAtdIEyrK1TSovxQbjtpZTl KKlkmg+/ATkTWAUbHzYIQAN2ZEX0sXqv4OZAzxvyIoXiLwyIoI2317mQuaTiAvNSjsZDql H+ztkOcfk5n1yfzi7NaYjVMelwPds+ZqncSmFz3XCFddwvDGDVmf1H5ev643hw== 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 4VY8tX35yvz17bT; Mon, 6 May 2024 18:23:48 +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 446INmpn042807; Mon, 6 May 2024 18:23:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 446INmkv042804; Mon, 6 May 2024 18:23:48 GMT (envelope-from git) Date: Mon, 6 May 2024 18:23:48 GMT Message-Id: <202405061823.446INmkv042804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: 308caa38cdf5 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 308caa38cdf5db4d688b7243d74ecd301b77945f Auto-Submitted: auto-generated The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=308caa38cdf5db4d688b7243d74ecd301b77945f commit 308caa38cdf5db4d688b7243d74ecd301b77945f Author: Marko Zec AuthorDate: 2024-05-06 18:21:55 +0000 Commit: Marko Zec CommitDate: 2024-05-06 18:21:55 +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); }