Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp619432iol; Thu, 9 Jun 2022 10:12:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLqOh3iYDXTc9B/ApATTo+R7JP05O6v7M+AuBuPmZgyvl9yrjejOMUtkxp93y1jV5yYkVA X-Received: by 2002:a65:6cc8:0:b0:3fe:2b89:cc00 with SMTP id g8-20020a656cc8000000b003fe2b89cc00mr8880484pgw.599.1654794729312; Thu, 09 Jun 2022 10:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654794729; cv=none; d=google.com; s=arc-20160816; b=CdXdMz5LjObidT3gVa1Tg2+lpIWqeH84GM4H6sm7UzoSKOdtsVoXM0UI5jyCVnmjTn uy3Mpe8FdG/pV4Cu19Okcyzvn1cNn0hJuNhPo4EkAdeRwRaojNPpvc4Q4CZkA0nFfwAk 3emoQC8eSCMECvCcekxY71gbDsjAnoIWHD1M2gt6vbXuKrRWeWZOni7Jt3s2M3EHSijL 5w7p7V3BTOmthQr5PYL/dhCnYwCt5cwa37lkaa3Au1CYCfAGs6IgWOhCx3lQaVcxPGQ9 y/dh509erXx3D0+PV/AFDUzu1OOpxrWhetvSndA35e0WB4xgFgB+GGpcQKeLd3NqX1bJ rXhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=gVI3Ea/l9RerBozp3vD3BZhKp1cPeVbhqnYdNTkFTUE=; b=IVAI/UGObf1KJlK4d7aYM06NOdWflumZGfuytmIXtNMnJLX3Ah7YQX/m3ljcxtMGqo OECS8qL0GzCikn37Ayofqet5LyQR9Zy2uF088ua3C8HnTPb1+X9EY/ZL/ITyNhczeZN5 nXS7uHA7nZtsYyDuiW4KkPwNI75knVLOsJCXYmmZgpVFc0Oy4pOfK0nD9euIJI3njl8h BhqlzASa79YGrkhfKcegHNAlMfO+PJzl5myPJ8OGmT3JDf2MbqyExJN2k9P3WoxIL8b3 gUMWMKF9875d+xjABcx2Piqrg/teIvlAfEHlwYmPJZ0qfLKNTckg366UzA6CeqLsGXvz Tyng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ueZd8oLT; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e128-20020a636986000000b003fdb58edcf2si16931894pgc.435.2022.06.09.10.11.53; Thu, 09 Jun 2022 10:12:09 -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=@infradead.org header.s=bombadil.20210309 header.b=ueZd8oLT; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244761AbiFIQpb (ORCPT + 99 others); Thu, 9 Jun 2022 12:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232459AbiFIQp3 (ORCPT ); Thu, 9 Jun 2022 12:45:29 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91E21900FA; Thu, 9 Jun 2022 09:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=gVI3Ea/l9RerBozp3vD3BZhKp1cPeVbhqnYdNTkFTUE=; b=ueZd8oLTQhOOq2+OTonDgw8aQt +p3JalI3+ek/mLSW7qX3pduaIdhafG+uHamo6+Z4WYWSnGq4feHGxAoEAGuf5xjFhOt2QwGiVlj8f E12cXHcNNPaCbF80Z1+jSZj7PLLrq1Ybs24VRlE8wv/tEVDyqgynyVdreoZVe6mOE75Ns7jHh0WWW Pq2yjGjqgH5bMAeZT4CARnDZIjVJbKwcKITy6FhP/e7OSxr4b7M7tlcHlb15v9s4UIKjIIzgCQNBn 2uLfk54tc6rUIqonQQBn4gRpbXR3FznYH+fBOtlCV13Q1Rax8eZGXAm4PFU5FkNN3XNQz9l1J7D6a qz91+VGA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzLHi-002vFC-Om; Thu, 09 Jun 2022 16:45:26 +0000 Date: Thu, 9 Jun 2022 09:45:26 -0700 From: Luis Chamberlain To: Alexey Gladkov Cc: LKML , "Eric W . Biederman" , Linus Torvalds , Andrew Morton , Christian Brauner , Iurii Zaikin , Kees Cook , Linux Containers , linux-fsdevel@vger.kernel.org, Vasily Averin Subject: Re: [RFC PATCH 0/4] API extension for handling sysctl Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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, Jun 01, 2022 at 03:20:28PM +0200, Alexey Gladkov wrote: > On Fri, Apr 22, 2022 at 01:44:50PM -0700, Linus Torvalds wrote: > > On Fri, Apr 22, 2022 at 5:53 AM Alexey Gladkov wrote: > > > > > > Yes, Linus, these changes are not the refactoring you were talking > > > about, but I plan to try to do such a refactoring in the my next > > > patchset. > > > > Heh. Ok, I'm not saying these patches are pretty, and looking up the > > namespace thing is a bit subtle, but it's certainly prettier than the > > existing odd "create a new ctl_table entry because of field abuse". > > As I promised, here is one of the possible options for how to get rid of dynamic > memory allocation. > > We can slightly extend the API and thus be able to save data at the time the > file is opened. This will not only eliminate the need to allocate memory, but > also provide access to file struct and f_cred. > > I made an RFC because I'm not sure that I did the permissions check for > ipc_sysctl. I also did not change all the places where this API can be applied > to make the patch smaller. As in the case of /proc/sys/kernel/printk where > CAP_SYS_ADMIN is checked[1] for the current process at the time of write. Thanks for all this, can you also add respective selftests extensions for this on lib/test_sysctl.c and tools/testing/selftests/sysctl/sysctl.sh ? Luis