From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A155FA0A0C for ; Tue, 3 Aug 2021 14:22:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A35C411D4; Tue, 3 Aug 2021 14:22:54 +0200 (CEST) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mails.dpdk.org (Postfix) with ESMTP id 3F32740E3C for ; Tue, 3 Aug 2021 14:22:53 +0200 (CEST) Received: by mail-wr1-f51.google.com with SMTP id h13so11638117wrp.1 for ; Tue, 03 Aug 2021 05:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ckn6FJfTEWdfSCa1ANt11EpN2J/LSJ9FQBYgsn9GAKE=; b=CiibW46mG+l0bRVtHNzkgHAhs7QpPYcs6Ljrwmf7GTjOoKePny98i3kVoz4WMZfoVn dWtN5Z0u8rXt8R838P8m6OMadImb967UQ+UzR9fn2k2w3vC+zzGFxDy7sjMNgT4kTWXS B+rkhSQP++dyBvnM+oIwoSh+fvFm5OoYtJ9F3f8kW8+TNar4/5gzL/CZQ/AdHfWLf1iT gnccI1D08C7/B1KUGzj2z6k0AX9xbZjKZY0DEJLFQkjA2qeap5O32jfmYZN4affwAj1q g4UK2bodDLF5MlMM7f/4vlUQlW93sokUHbpt2h8oIpDR92WmOlmDukZGxmsy91lZmOgY Qg+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ckn6FJfTEWdfSCa1ANt11EpN2J/LSJ9FQBYgsn9GAKE=; b=j7/qi5ZUxnvgTq7NScFLyf62bWyOt6GoocjSaoKwdYqNfCyZXvWzP+ND/rM3ws9BtJ BFnFAa+hYBDm8o7pH/BYvFQv6bZbd+wY+kxfK92fj6AdbCYCxR71HSw++7LxW9uCSZjk TXt+F2A7KQ4eqqd+30ZGuw53TyFWt7q+0mSsbi6CTpi2fnWYhnu62bCkpcowr6+/wuyh ltf0qcN0XgP2RBFfXzEmw33jhNoF+OGYMVa+VwqKAbDr1U96OJkCwNICWArqa8Aa0lgG 9fjOvy2RXRiA2UymQuEpBuK8WwNgfxEBNsPn/xuI6vwXQxB0BP/Yt4uquILxQNbqbEHI UrHw== X-Gm-Message-State: AOAM531I8rUhNGYm004NvfiOS0qVxkSgU552jrIuUZvr3dKzKJchJTp1 t9FCtREkjN7MSznOe4zJrbs= X-Google-Smtp-Source: ABdhPJxXHiA3K6TRu64TllH9H8x5WioMvoCGLYABTp23gh9hPxsREpIDHIePeRpo9/0JBWLkLgg2lQ== X-Received: by 2002:adf:f74f:: with SMTP id z15mr23012799wrp.54.1627993373070; Tue, 03 Aug 2021 05:22:53 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id f15sm14377225wre.66.2021.08.03.05.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 05:22:52 -0700 (PDT) From: luca.boccassi@gmail.com To: Nathan Skrzypczak Cc: Jakub Grajciar , dpdk stable Date: Tue, 3 Aug 2021 13:22:03 +0100 Message-Id: <20210803122214.1094992-14-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210803122214.1094992-1-luca.boccassi@gmail.com> References: <20210726135322.149850-59-luca.boccassi@gmail.com> <20210803122214.1094992-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/memif: fix abstract socket address length' has been queued to stable release 20.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/05/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/d43a754af8524be6720ca957b8b0ab2115c109a7 Thanks. Luca Boccassi --- >From d43a754af8524be6720ca957b8b0ab2115c109a7 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Fri, 23 Jul 2021 11:18:57 +0200 Subject: [PATCH] net/memif: fix abstract socket address length [ upstream commit 4e30586dcdf09e670f2e3c6b58c919f6b887d431 ] This fixes using abstract sockets with memifs. We were not passing the exact addr_len, which requires zeroing the remaining sun_path and doesn't appear well in other utilities (e.g. lsof -U) Signed-off-by: Nathan Skrzypczak Reviewed-by: Jakub Grajciar --- drivers/net/memif/memif_socket.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c index c526f90778..c3008f5ce1 100644 --- a/drivers/net/memif/memif_socket.c +++ b/drivers/net/memif/memif_socket.c @@ -866,6 +866,7 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract) { struct memif_socket *sock; struct sockaddr_un un = { 0 }; + uint32_t sunlen; int sockfd; int ret; int on = 1; @@ -890,7 +891,11 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract) /* abstract address */ un.sun_path[0] = '\0'; strlcpy(un.sun_path + 1, sock->filename, MEMIF_SOCKET_UN_SIZE - 1); + sunlen = RTE_MIN(1 + strlen(sock->filename), + MEMIF_SOCKET_UN_SIZE) + + sizeof(un) - sizeof(un.sun_path); } else { + sunlen = sizeof(un); strlcpy(un.sun_path, sock->filename, MEMIF_SOCKET_UN_SIZE); } @@ -899,7 +904,7 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract) if (ret < 0) goto error; - ret = bind(sockfd, (struct sockaddr *)&un, sizeof(un)); + ret = bind(sockfd, (struct sockaddr *)&un, sunlen); if (ret < 0) goto error; @@ -1061,6 +1066,7 @@ memif_connect_client(struct rte_eth_dev *dev) { int sockfd; int ret; + uint32_t sunlen; struct sockaddr_un sun = { 0 }; struct pmd_internals *pmd = dev->data->dev_private; @@ -1075,16 +1081,19 @@ memif_connect_client(struct rte_eth_dev *dev) } sun.sun_family = AF_UNIX; + sunlen = sizeof(struct sockaddr_un); if (pmd->flags & ETH_MEMIF_FLAG_SOCKET_ABSTRACT) { /* abstract address */ sun.sun_path[0] = '\0'; strlcpy(sun.sun_path + 1, pmd->socket_filename, MEMIF_SOCKET_UN_SIZE - 1); + sunlen = RTE_MIN(strlen(pmd->socket_filename) + 1, + MEMIF_SOCKET_UN_SIZE) + + sizeof(sun) - sizeof(sun.sun_path); } else { strlcpy(sun.sun_path, pmd->socket_filename, MEMIF_SOCKET_UN_SIZE); } - ret = connect(sockfd, (struct sockaddr *)&sun, - sizeof(struct sockaddr_un)); + ret = connect(sockfd, (struct sockaddr *)&sun, sunlen); if (ret < 0) { MIF_LOG(ERR, "Failed to connect socket: %s.", pmd->socket_filename); goto error; -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-03 12:35:08.806906678 +0100 +++ 0014-net-memif-fix-abstract-socket-address-length.patch 2021-08-03 12:35:08.234819128 +0100 @@ -1 +1 @@ -From 4e30586dcdf09e670f2e3c6b58c919f6b887d431 Mon Sep 17 00:00:00 2001 +From d43a754af8524be6720ca957b8b0ab2115c109a7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4e30586dcdf09e670f2e3c6b58c919f6b887d431 ] + @@ -18 +20 @@ -index 5b373738e6..f58ff4c0cb 100644 +index c526f90778..c3008f5ce1 100644