From nobody Mon Aug 14 12:47:17 2023 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 4RPZ120F61z4qS8Z; Mon, 14 Aug 2023 12:47:18 +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 4RPZ116khBz3CD7; Mon, 14 Aug 2023 12:47:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692017237; 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=e+3nEzO+Wmst7nG1EDX9QgCYPAp5VmjOf21KalwHg7I=; b=O16/L1jHPu3m/oaH0Rc69oWFa1x71HhGJ5y+NcufDeGn3F8wdu9lKY7d7FDp/9qxzQwupc IfpE0mLqKlxAlsjTD7fZNK/x9y7hG2Xd5efYDyw7qeVn6jzxmcXU2ELSVgpGwK0Mj8FocC f7XwKt3YHhIHR+673lpzPnS6qskpysqQVXHEl+ZJ6InBbyNn0pa6azd87Y5siQYiexuLaY C+yQhgcetLF85Ld9OIoZ6AhSRxp7DyaJ4xGhCyToscGqlW076OS9rztRF8pF9sWQpOdHI2 Qq9ePkSBuZVukoDNrKXvvQByhvbckNYrAc1t1a9D/nLBixz8QcSR/dEJdfV14w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692017237; 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=e+3nEzO+Wmst7nG1EDX9QgCYPAp5VmjOf21KalwHg7I=; b=D88BemuChxJzLODQzur3mFl83/1+0vO/5V4VhZzG7rgITDMuLW6LyEU7fYIodNmuZKNYDp U0eIphAylRHYI2TvZiTAIUY/esdH6V2eQ/erM8q6kSjv4tb/L6yWpPj2FlG2dfMVKQNfEC m1Q/A0JDKJ09sAKzs1WQYGM2RhaXFlM9EQHqqr/uVsUB1mPCiofGRznOJXRumsE5OFNJ9c cLJnOH8iMFQTxCtzWzsGl6tX1nEfpuDCrqoKj3xzddYTkK4EMwmk4NU0j1IrD46wtlxNq4 /OaTg500FkvbdwouKKngW0thlyHZvJpV2Qu8XmbL1RNxUtRbq+EzkyYOeW5UBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692017237; a=rsa-sha256; cv=none; b=gp0pAEUxhx15Vaof3dN4/3puJC0FxACT5Y7iBfaVgd7E2+SzosRpcerzs10D04r+uV6bge DOd3waYCTCWX2aAF/zKJnbHbd+hYIzfxGgvGNK7NEO/bTTYpngzDMlhwArhWcCSN4xpoGj La2BWVu9AMUH85mjwhUM2rbHeDYUXlF32PARptjZG1XzeXKLDRLTzOty4vFNSXyzZuDJFT A12KKdm52sKBzaTnC81YaqQBbQdyhFDPefNL0OWfvw+FsEL/C5zNg0DkFCS33LNQxtgefM dK4umW3TFtaBbReut+jyMm9YKbrwcmsye3RDaJRFRQIEFWMuXVF6SmUAmwmSew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RPZ115rH3zTgS; Mon, 14 Aug 2023 12:47:17 +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 37EClHLY044319; Mon, 14 Aug 2023 12:47:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37EClHe1044316; Mon, 14 Aug 2023 12:47:17 GMT (envelope-from git) Date: Mon, 14 Aug 2023 12:47:17 GMT Message-Id: <202308141247.37EClHe1044316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: bbaa5523c01a - main - linux(4): Skip unsupported anxiliary message 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: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bbaa5523c01a11e1e322928639522b9ccfd19978 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bbaa5523c01a11e1e322928639522b9ccfd19978 commit bbaa5523c01a11e1e322928639522b9ccfd19978 Author: Dmitry Chagin AuthorDate: 2023-08-14 12:46:12 +0000 Commit: Dmitry Chagin CommitDate: 2023-08-14 12:46:12 +0000 linux(4): Skip unsupported anxiliary message Instead of returning error, skip unsupported anxiliary messages and fail if no one handled. MFC after: 1 week --- sys/compat/linux/linux_socket.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 1acd93122b8f..90dc25f2e653 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1728,7 +1728,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, struct sockaddr *sa; caddr_t outbuf; void *data, *udata; - int error; + int error, skiped; error = copyin(msghdr, &l_msghdr, sizeof(l_msghdr)); if (error != 0) @@ -1794,7 +1794,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, msg->msg_control = mtod(control, struct cmsghdr *); msg->msg_controllen = control->m_len; outbuf = PTRIN(l_msghdr.msg_control); - outlen = 0; + skiped = outlen = 0; for (m = control; m != NULL; m = m->m_next) { cm = mtod(m, struct cmsghdr *); lcm->cmsg_type = bsd_to_linux_cmsg_type(p, cm->cmsg_type, @@ -1814,12 +1814,13 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, } if (lcm->cmsg_type == -1 || - cm->cmsg_level != SOL_SOCKET) { + cm->cmsg_level == -1) { LINUX_RATELIMIT_MSG_OPT2( "unsupported recvmsg cmsg level %d type %d", cm->cmsg_level, cm->cmsg_type); - error = EINVAL; - goto bad; + /* Skip unsupported messages */ + skiped++; + continue; } switch (cm->cmsg_type) { @@ -1877,6 +1878,10 @@ err: if (error != 0) goto bad; } + if (outlen == 0 && skiped > 0) { + error = EINVAL; + goto bad; + } l_msghdr.msg_controllen = outlen; out: