Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1159665rwd; Wed, 31 May 2023 10:09:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7pBcHLAi5A8VI1K/0rBXSKAJRyu2x8N6nawJbRKWfLBk9onjxQoQg0WWU/xo7asZPvjR/W X-Received: by 2002:a05:6358:4298:b0:123:6466:4fb2 with SMTP id s24-20020a056358429800b0012364664fb2mr1434895rwc.24.1685552976999; Wed, 31 May 2023 10:09:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685552976; cv=pass; d=google.com; s=arc-20160816; b=a7uySjSsjjlpfpSnzyqCWaBYfybCdqtFhAL95ajF3NC/s2gprRSMGKlR0T1GiL9hwg g2Zxx8rvRX1API0SZFy5ncXRgRjRROgi4nL83nlZFT5WqDBHmgBiPaOngpBsPyhuxw4l xC1cDS7KP3kLHdVGXzL4Fq/wcYH0EOccagHFfgLfmF0i5HGjm/ThZzoAIRe23FZySgm8 dFlYP1qe2MShSyJWBSfNMoajJTh1XZtDBuf0HY//Xe7m/vO7LOL71/leSnn3VBWgkmQ3 5C2BMkKOAF5+HFGdZcn9NKV7uoyVVcet4KIGequNYOF6tyhPIUD+mLYQua7CtWtt7V/O mK5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ISmg6vTKkuqnUPwvHsEl5XLHMcQyMZAZ5zRIBeuCsVk=; b=v7x/9WoF0ZOZZOXBNaJnunkDOFlipCkDIQgOXCCmWDNc3UcE/Ch8KCHAw5BEVso6k4 I0eBHdGL3pKc1ayejG0ihVBbRkrayq8jQGmz+Y/yixJGHft4GtJ4TXmxWlSK2sy3Yjfv O8BBiLuzATjY8pOJfu7ROU0TK0IqKkgmzLPd1iWapHqdydkZLFsEBcRhi0DKZp17TEsM vOQvcqe8PKzlBlHuwLA3wO6g48f0R5A6gRL5Ssg6hYAsEzrTYWHSElKLYIFnrAuIqgwI dMfWapJ4XOIx4CAicJdppmZbwzvtB4/zNZqHVJlmXmeAb1vjeEjAdaToLTsAH90bWpr4 Tfng== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=IlI8K9Mx; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d36-20020a17090a6f2700b00256a7c340b1si1315856pjk.3.2023.05.31.10.09.23; Wed, 31 May 2023 10:09:36 -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=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=IlI8K9Mx; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229984AbjEaRDV (ORCPT + 99 others); Wed, 31 May 2023 13:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbjEaRDP (ORCPT ); Wed, 31 May 2023 13:03:15 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2120.outbound.protection.outlook.com [40.107.212.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81503139; Wed, 31 May 2023 10:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Puu08xSwKHZGjixwCJavPsPe3PcbCHEwQVFiXO4X51H/xvHep6Zwlv8DdjnMUNoaY3h2rCYc1io9qbhzc2Y5FNYHpMg2ipTZSk2DNoNF12+Nvwxy1NWtZtr1TtYA/YKvBDqdKCvh5H52mSJcYd2ohqOXaQ0TrZnzEx+Qo3ergN46R7gOL7suRBTnnjODyzc+m9bMTr03aX8emvDBx/YNXYzeh24QAyIkVdOdqPVRI8Vb6Pa5pWbSJmu9B/FSJISc8n1ly6pvR65GPQghKclfSxufzr6xpwpVyDVzJlch6KLYrLhE+EjRdcQv1BDA/sBa2eNwQqsJZPt35PYMtDBhag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ISmg6vTKkuqnUPwvHsEl5XLHMcQyMZAZ5zRIBeuCsVk=; b=cVvQ/3gYLnruQJQNE0CQ+3umLaJO/9bNWknFxsRaP7lk+qi44ahWCmV2x01Hw6bfCVzHoyDWUNF6QO1wp27DmBxxzz1n0nT1TLeVl48OlWbwDowN+kFZ6lopYuWk61Rtdv15tJE+qNVn88zmAaUyJxc7KsBIHv8c4kO9o0YiDKez43V7WyTWwPzSb5AdpoWHwZCSlefJczgdR8h3RvASLsIo6atGd+p4uDnDdyhYRcyp1ABveWzEq9J89xgtUSJkHaQAlOyseW4BDcffPpMoq9bNLrkJ5D+nTomIE6+Cdhz/1FDhL1XCbJnyWKq5+posQJ51V9uVWEUdCRtCr2BYFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ISmg6vTKkuqnUPwvHsEl5XLHMcQyMZAZ5zRIBeuCsVk=; b=IlI8K9MxxiWY3aeRJVpJKDepZ2BnqlUlPXX9ywRoe5uLz5ngJHbg8y+iqXVEB4AmkCaOTxBp5kqJQaZkQ0Qn24xIE41L9C23dwxgJsYQE0M+M+1sNVb5pVNTwPCkUFCtmK9KE1T99t8bXg6a8eYSNW+A1TAJfEGTAMYSc2LdBuk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by CO1PR13MB4839.namprd13.prod.outlook.com (2603:10b6:303:f9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Wed, 31 May 2023 17:03:00 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::5e55:9a39:751f:55f6]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::5e55:9a39:751f:55f6%3]) with mapi id 15.20.6433.024; Wed, 31 May 2023 17:03:00 +0000 Date: Wed, 31 May 2023 19:02:52 +0200 From: Simon Horman To: David Howells Cc: netdev@vger.kernel.org, Chuck Lever , Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2 2/6] net: Block MSG_SENDPAGE_* from being passed to sendmsg() by userspace Message-ID: References: <20230531124528.699123-1-dhowells@redhat.com> <20230531124528.699123-3-dhowells@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230531124528.699123-3-dhowells@redhat.com> X-ClientProxiedBy: AS4P190CA0043.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::14) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|CO1PR13MB4839:EE_ X-MS-Office365-Filtering-Correlation-Id: a1fcdcbf-5a09-46f8-caec-08db61f8e399 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M+oztPPB44I074oovH3o9XoOeiqXHeymXD0b8QxFnGcRe6GsNbrjNmgqSWMwmHOVd5dmcPg5HQ/7GiJrcwfVIxGseLpFTc5S7lprfv4U2MH9TVayOCAk4uKL7VugNHRFF8otG3tV+0SwKLmu3RK4SpTqanVyCxtAiPlTlcM9NxH2bdHQiOVQRVWnKjcZPBPf2CxXGgR3nbzMkaV3hkmrEQsBp3bvOQYH5OczTWlvMIgdH3tSfW/NOnWNXneSV+QW5xzOVvFxxwQaSs9MyWYRaV9+hpRVcD6y5kNU39IcRqBOUu+UBVn2YlofjCEel0nfqJJqh1tqPJUYhqPO57KFzRE2imPBOhK+QqzQo+FSer5YtkhRqCBifI3NR97A2W0C1zGF7G27uz6fv4mgNU2vi4YpWbYjkPtt3KRuJYVazx/Ld3F6kOAT/SM4kmxEHr9Ab4T/8i3gaZhFVU6z81clf1arZQycvEc9HGrDFRCSx+MfEfGq7WsWjlf48DAEvXp83fWZn/kcVbL0K+iGJ71gkxvfsRt8djSLi+bO1mcc8tB+KQNQ8nZ5nn/Fu7Yi6GWeriPhRhrQA4iKw5uTSs242Q4d2MCwdxUlPTB0h2ddEpA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(39840400004)(366004)(376002)(451199021)(6486002)(86362001)(41300700001)(478600001)(6916009)(6666004)(4326008)(44832011)(316002)(66946007)(36756003)(66556008)(66476007)(7416002)(5660300002)(2906002)(4744005)(186003)(6506007)(6512007)(83380400001)(8676002)(54906003)(38100700002)(8936002)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?61BJzjAl+CaFtLMdncEcfnq7xPWk9kFploZSkMglcPWwxib+b2mVTWQ7FydH?= =?us-ascii?Q?mCv3lITNnHLoz15a8/nFKeFJzdTvu1kUtrqgeaMKDdMJj3s7sKcBdOTHnAUj?= =?us-ascii?Q?TPEVXbIEKF45k4yD6IrF4FVt3RY6wC7jrkwxNPBhwDktR2XDR8mIPFyBEL8v?= =?us-ascii?Q?gSN2c1plJFXt5rqYK6hAGsBb3FwZiJ99G59oWdPmh5uXTuLw9rTxNqgs54nl?= =?us-ascii?Q?g1Jn84faz3/imQw9Vn2bvfBWsJaAMzz322RmeJoNUxtbfXJXiAnKM927QBRH?= =?us-ascii?Q?kM/dMm2xE6bMBGJ7Rmij714EacVtHAW/kStzX8muJ4OooHzV5nbkei5cSukE?= =?us-ascii?Q?G1amzo3uE7Tn6JICqk/QfHdrPJmFPNcuHDfMKlN+jQXfG1Y5GOeoqfmX8GNu?= =?us-ascii?Q?QNU5ruvh4KfQnhuvkqkdoBgW2PpTXEyjYAaYu4qA1gvbYF6yVMEfNFlW5dEa?= =?us-ascii?Q?dP9uhyqkg565qVVI1gjIC0VCcKdNjwTMuMpcn5XxJkrxINHHzNS1Ers+rHem?= =?us-ascii?Q?IzNjZGdCACbz/ijz2snkCIFB3+7j400T4yc6o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l44DmKOBlqiKz4cbc14rtQ10n32w3E3bnLT8tt1QPXE979An?= =?us-ascii?Q?2xUaRj0C8daKg4YvrhiJdIKsUzatnVIQdvMZ9wi974F5MbeQivJUlyUfBDcR?= =?us-ascii?Q?e5yvhJ/9cc4vRvkg0tSV+VL0jLIQcXnlCpElN31qAeWSrOrMey9AlknIXWKs?= =?us-ascii?Q?CinMzkUqmZ4GScsMF30P98Qj6SeXwC8H0DSOkwsbjhakp4F4tVuLIGo93RMH?= =?us-ascii?Q?OhUkrA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1fcdcbf-5a09-46f8-caec-08db61f8e399 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2023 17:03:00.2736 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 44HFhWcAyLr5fcV728HBXFWxkHsQGS5keuMgPfEiBaZQm5mcY12dEwFjRegkVcJ0kFQ9B2gkBoM0qfH4dz039m/ub3n25bjertEmEId58w4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR13MB4839 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 On Wed, May 31, 2023 at 01:45:24PM +0100, David Howells wrote: > It is necessary to allow MSG_SENDPAGE_* to be passed into ->sendmsg() to > allow sendmsg(MSG_SPLICE_PAGES) to replace ->sendpage(). Unblocking them > in the network protocol, however, allows these flags to be passed in by > userspace too[1]. > > Fix this by marking MSG_SENDPAGE_NOPOLICY, MSG_SENDPAGE_NOTLAST and > MSG_SENDPAGE_DECRYPTED as internal flags, which causes sendmsg() to object > if they are passed to sendmsg() by userspace. Network protocol ->sendmsg() > implementations can then allow them through. > > Note that it should be possible to remove MSG_SENDPAGE_NOTLAST once > sendpage is removed as a whole slew of pages will be passed in in one go by Hi David, on the off-chance that you need to respin for some other reason: s/in in/in/ > splice through sendmsg, with MSG_MORE being set if it has more data waiting > in the pipe. ...