Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp25537imw; Tue, 12 Jul 2022 13:56:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJq3r5ZD35lCQ0QloCpl7mA+whfYsQ7s7PGlSkriNrgJkv4MyaduSfA0EbM9P23th8FPYl X-Received: by 2002:a17:902:7c8d:b0:167:9520:d065 with SMTP id y13-20020a1709027c8d00b001679520d065mr115140pll.101.1657659374038; Tue, 12 Jul 2022 13:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657659374; cv=none; d=google.com; s=arc-20160816; b=IbmPaOoJEd8AmXcRNFKVLtVP8Kqa626nXLayx3DibCFYjxgRu4k/YM39lUxTGtIBmi +ftsIrAPInOSYVZ/xainyNt9BxkaEWlfeEBNqAiG6X9E/aR84uKzuL7pGg0RtoXqCwtv S5QfTRMlf3j/spCxC07HasuJxLlxNBlZ6pKojKve481F7rE7LSGC8sUgKK0KFIGET0sl qsDLeCZeCqzE0dpUFNiO/HuuYdRxqVb1Dkl0GwOo7nThv+QeQdHpxf/NEvL8c7VeARyS pZYwsp2Fd7BzG/HA8/5OLFHfW61X/8U01h37NRSz7bESaPzVrnr9lhVZYqSwASZC5IaQ lgyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gX+xYQxM94KdtlI7YGh/i2Kh7GR2uKZ7IifaNrt+CnI=; b=tGmTtEZuhlUHuL70ljwHI0Hmsi2XQdCTt25RazsbqaVstcvnWMLXls//3xOwrrw3VW AU2S4Vx+L0mttDVvqDsrqX/fo6FgjY8DqE/LaKn5dJ34IffA7LenhvD3O/5L6IS1z8gH O7SFLexuV2Z7x3EfiliUmwHNTMbctvV9tfJjAYO8SIK2D3dmkVOIJ2IRusDtRNocxZPi Ef5dssiTZ8uJay/AVDkTS5prpocROgxmemA7+qGox5f3bn5nPlok96zmEX8yRhx/DhD2 o9b972FrSDqxmSBOqesuDgFonJKojnS0FyyppjtTKuPsSLj7Kd3TcBx+3+yo3VPeg9AU YXyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qwHfey5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a056a001a0e00b0051b904d9c7csi16912361pfv.251.2022.07.12.13.55.57; Tue, 12 Jul 2022 13:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qwHfey5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234053AbiGLUxp (ORCPT + 99 others); Tue, 12 Jul 2022 16:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231857AbiGLUxh (ORCPT ); Tue, 12 Jul 2022 16:53:37 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52869CEB8B; Tue, 12 Jul 2022 13:53:15 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id h17so12872942wrx.0; Tue, 12 Jul 2022 13:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gX+xYQxM94KdtlI7YGh/i2Kh7GR2uKZ7IifaNrt+CnI=; b=qwHfey5WrSh60CwhUhPpq9J8tMgPyA7SZrCS0uF/kzXsPtQ8Qk713E1Zm8O7OEwpli BEhdg+7WlQv0h4u5QBgCsk/caRl+1HXHwz84/fL63Oz/UD+QWjJNCoR44z77rirM68xS yh4m0OkzkPcCrPHX0m3uMruKKKfY/+u8w7BJGitMF062xQYL0SXHbKAeR09KLaNY5FZH syKClEWRPA48a8VLoxlYcPPxN9Sj0j++LO8k4BTQdUOErukuiiWP8+u2rDsuygIV+0xP a2ybPvIDpHK/VFiBVVjs9vMnc8PZlCx3p4M45yniprJGOQXUF+kKnIusZrcrdL/WTG7o Xvvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gX+xYQxM94KdtlI7YGh/i2Kh7GR2uKZ7IifaNrt+CnI=; b=7YauKXK8kAFhqSGt63X2d+NGtKaXOreDSaUmPmoNPtVbDCw1DXm7SFnVXle+w2Rp3g ZCtGyaq9KNuwEei81kZP26ZuKY9QAoaAee7eJZAw+ft3FerhtsEDWZvyeNrqOS/l7CsV B84IENg1jbLAQrGGbyIOLEOZz7qPYO5oRWKfU8F8Y8py1B4OlCz5KhfcmHPjdI5kFhh3 J+RYnxbDS84VqGWHJMjd2tYjUySOJZCGoxJ2SvobzMRfeZKwYZm35Xs8vQDnETWtvw3m EQGvFQpap1olEqtP0WuPGd99UDTGATMNck1PHjBQ2Go/YQwBVJeJJe/X18ahLm9PICeq eE5Q== X-Gm-Message-State: AJIora9rOpUZVl4lQdZA07iVDzi0HXvzH0bAF8kSg//5LnoJUlz9xBQS xDiid21C+wfmxCzoSNlx6BruYIjwjQ4= X-Received: by 2002:adf:eccb:0:b0:21d:7b41:22c7 with SMTP id s11-20020adfeccb000000b0021d7b4122c7mr22293206wro.543.1657659193344; Tue, 12 Jul 2022 13:53:13 -0700 (PDT) Received: from 127.0.0.1localhost (188.28.125.106.threembb.co.uk. [188.28.125.106]) by smtp.gmail.com with ESMTPSA id c14-20020a7bc00e000000b003a044fe7fe7sm89833wmb.9.2022.07.12.13.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 13:53:12 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "David S . Miller" , Jakub Kicinski , Jonathan Lemon , Willem de Bruijn , Jens Axboe , David Ahern , kernel-team@fb.com, Pavel Begunkov Subject: [PATCH net-next v5 05/27] skbuff: carry external ubuf_info in msghdr Date: Tue, 12 Jul 2022 21:52:29 +0100 Message-Id: <2c3ce22ec6939856cef4329d8c95e4c8dfb355d8.1657643355.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make possible for network in-kernel callers like io_uring to pass in a custom ubuf_info by setting it in a new field of struct msghdr. Signed-off-by: Pavel Begunkov --- include/linux/socket.h | 1 + net/compat.c | 1 + net/socket.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/include/linux/socket.h b/include/linux/socket.h index 17311ad9f9af..7bac9fc1cee0 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -69,6 +69,7 @@ struct msghdr { unsigned int msg_flags; /* flags on received message */ __kernel_size_t msg_controllen; /* ancillary data buffer length */ struct kiocb *msg_iocb; /* ptr to iocb for async requests */ + struct ubuf_info *msg_ubuf; }; struct user_msghdr { diff --git a/net/compat.c b/net/compat.c index 210fc3b4d0d8..6cd2e7683dd0 100644 --- a/net/compat.c +++ b/net/compat.c @@ -80,6 +80,7 @@ int __get_compat_msghdr(struct msghdr *kmsg, return -EMSGSIZE; kmsg->msg_iocb = NULL; + kmsg->msg_ubuf = NULL; *ptr = msg.msg_iov; *len = msg.msg_iovlen; return 0; diff --git a/net/socket.c b/net/socket.c index 2bc8773d9dc5..ed061609265e 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2106,6 +2106,7 @@ int __sys_sendto(int fd, void __user *buff, size_t len, unsigned int flags, msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_namelen = 0; + msg.msg_ubuf = NULL; if (addr) { err = move_addr_to_kernel(addr, addr_len, &address); if (err < 0) @@ -2171,6 +2172,7 @@ int __sys_recvfrom(int fd, void __user *ubuf, size_t size, unsigned int flags, msg.msg_namelen = 0; msg.msg_iocb = NULL; msg.msg_flags = 0; + msg.msg_ubuf = NULL; if (sock->file->f_flags & O_NONBLOCK) flags |= MSG_DONTWAIT; err = sock_recvmsg(sock, &msg, flags); @@ -2409,6 +2411,7 @@ int __copy_msghdr_from_user(struct msghdr *kmsg, return -EMSGSIZE; kmsg->msg_iocb = NULL; + kmsg->msg_ubuf = NULL; *uiov = msg.msg_iov; *nsegs = msg.msg_iovlen; return 0; -- 2.37.0