From nobody Mon May 09 17:55:04 2022 X-Original-To: dev-commits-src-main@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 919FD1AD8656; Mon, 9 May 2022 17:55:05 +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 4KxpjN6dfDz4sR2; Mon, 9 May 2022 17:55:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652118905; 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=oyZeS/vMUU9tb/7/1Gie/fJdaalfF/yfdzzaWSsJlpc=; b=pc+/0UZjXk1XyKXZZ6KjbNBJ0HLJZg2sQ80yYis9X2E+QAHFbid9Sgu7Q42V7Ke9KYxw6+ hxsvV2Bwi+7FyvTWsnfc/V2BuXDlpiG4kqToNaFg96Gc8rjlL6tS3n7P/H61dfX1P2+nq8 6a70UaQ8ezC06wdZggwYYGBC2Bv5t+WZnAFFcKQ0zTOrmLH8V+yVKJv5gV0RXhGYiyhhtk DJkXtJdRFdmBuv0ovVP3UvaueSS2gSSJcd4NO56vR/KXB0GLMtyPcUM3zdFjQWi2nkkFI/ GjK6OdUynxW5NzGPdGRBesl9iyrmafZX7XQoliABVjMca8bw8dgnB9xZiL5uWw== 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 982E815B0B; Mon, 9 May 2022 17:55:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 249Ht4L3061052; Mon, 9 May 2022 17:55:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 249Ht43q061051; Mon, 9 May 2022 17:55:04 GMT (envelope-from git) Date: Mon, 9 May 2022 17:55:04 GMT Message-Id: <202205091755.249Ht43q061051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 24df85d29a30 - main - unix/*: unp_internalize() can sleep, so allocate mbufs with M_WAITOK List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24df85d29a309522a4878bdf382696c7319ce898 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652118905; 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=oyZeS/vMUU9tb/7/1Gie/fJdaalfF/yfdzzaWSsJlpc=; b=KQQS+wgk30WTHWVohlAl1TxMqeW2V0MuNaOF5pMfT10dGt3WDqhQkeFYYxQs9niCOb8DHy aR0HVaJ1hfag5XFiAXFMJG1sQP4ZeZXw7Ji3TJ4NG29vuJUo9avPMYkSytw4YASaAWa+xa kPSnyEBPjeQIWfR6a73ulOTh7HHW5wj0nG0d4sXeWIeLods/Mbpe+xYRrZJ3+PdJQRLn6E Gy6Z/6lGrdMunyWBWdKuK5/u/l1uGpud2/k5BttodOWb8gEYufwlhnCzWpu3TcsBl9snzt oFk5ylaGrviq3on3+Nntnm2G0dKsNibeR+PkUkA5hoWiSSH1SCr4m82IZizF4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652118905; a=rsa-sha256; cv=none; b=ThW923SXxQAsxzk3N7QfOen3HfTwacUnoa3lsRcfrwFOwYAIUIPkNPnQdvuoF1JsHmNGwF QUky5cUMJzJ2RfRk4R3rF9ILjGvALXxSsRGZ9w5suOCgJp9u3Hlr4szeDMaaEvlsSPFCdS 9MGeZt5YTx/XCu0pQsEdHi2ObywyCRa2SMWjbOA3DV5mCp5WL3X3MXUIPQI+IB0H87PJe7 S9AY/w5FcXTewYolBBUddwoNpHp9j7duYjsy95h7FJUZebApEG8eeHcmGp6FklbmgHPnie mfrd6qI601I7I+U0pnKxIMMhgsyYmx1paY5hzM0ns50TF3dTJGMtDFA/ym5aCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=24df85d29a309522a4878bdf382696c7319ce898 commit 24df85d29a309522a4878bdf382696c7319ce898 Author: Gleb Smirnoff AuthorDate: 2022-05-09 17:42:48 +0000 Commit: Gleb Smirnoff CommitDate: 2022-05-09 17:42:48 +0000 unix/*: unp_internalize() can sleep, so allocate mbufs with M_WAITOK --- sys/kern/uipc_usrreq.c | 49 ++++++++++++------------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index f1b7dd75008d..3ce7ddcd7f17 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -2232,12 +2232,8 @@ unp_internalize(struct mbuf **controlp, struct thread *td) * Fill in credential information. */ case SCM_CREDS: - *controlp = sbcreatecontrol(NULL, sizeof(*cmcred), - SCM_CREDS, SOL_SOCKET); - if (*controlp == NULL) { - error = ENOBUFS; - goto out; - } + *controlp = sbcreatecontrol_how(NULL, sizeof(*cmcred), + SCM_CREDS, SOL_SOCKET, M_WAITOK); cmcred = (struct cmsgcred *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); cmcred->cmcred_pid = p->p_pid; @@ -2280,13 +2276,8 @@ unp_internalize(struct mbuf **controlp, struct thread *td) * file structure and capability rights. */ newlen = oldfds * sizeof(fdep[0]); - *controlp = sbcreatecontrol(NULL, newlen, - SCM_RIGHTS, SOL_SOCKET); - if (*controlp == NULL) { - FILEDESC_SUNLOCK(fdesc); - error = E2BIG; - goto out; - } + *controlp = sbcreatecontrol_how(NULL, newlen, + SCM_RIGHTS, SOL_SOCKET, M_WAITOK); fdp = data; for (i = 0; i < oldfds; i++, fdp++) { if (!fhold(fdesc->fd_ofiles[*fdp].fde_file)) { @@ -2317,48 +2308,32 @@ unp_internalize(struct mbuf **controlp, struct thread *td) break; case SCM_TIMESTAMP: - *controlp = sbcreatecontrol(NULL, sizeof(*tv), - SCM_TIMESTAMP, SOL_SOCKET); - if (*controlp == NULL) { - error = ENOBUFS; - goto out; - } + *controlp = sbcreatecontrol_how(NULL, sizeof(*tv), + SCM_TIMESTAMP, SOL_SOCKET, M_WAITOK); tv = (struct timeval *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); microtime(tv); break; case SCM_BINTIME: - *controlp = sbcreatecontrol(NULL, sizeof(*bt), - SCM_BINTIME, SOL_SOCKET); - if (*controlp == NULL) { - error = ENOBUFS; - goto out; - } + *controlp = sbcreatecontrol_how(NULL, sizeof(*bt), + SCM_BINTIME, SOL_SOCKET, M_WAITOK); bt = (struct bintime *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); bintime(bt); break; case SCM_REALTIME: - *controlp = sbcreatecontrol(NULL, sizeof(*ts), - SCM_REALTIME, SOL_SOCKET); - if (*controlp == NULL) { - error = ENOBUFS; - goto out; - } + *controlp = sbcreatecontrol_how(NULL, sizeof(*ts), + SCM_REALTIME, SOL_SOCKET, M_WAITOK); ts = (struct timespec *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); nanotime(ts); break; case SCM_MONOTONIC: - *controlp = sbcreatecontrol(NULL, sizeof(*ts), - SCM_MONOTONIC, SOL_SOCKET); - if (*controlp == NULL) { - error = ENOBUFS; - goto out; - } + *controlp = sbcreatecontrol_how(NULL, sizeof(*ts), + SCM_MONOTONIC, SOL_SOCKET, M_WAITOK); ts = (struct timespec *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); nanouptime(ts);