From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 499F4C43331 for ; Thu, 26 Mar 2020 06:58:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 152A7206F8 for ; Thu, 26 Mar 2020 06:58:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 152A7206F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 905E26B000A; Thu, 26 Mar 2020 02:58:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B5F26B000C; Thu, 26 Mar 2020 02:58:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CB5C6B000D; Thu, 26 Mar 2020 02:58:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 631FE6B000A for ; Thu, 26 Mar 2020 02:58:33 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 54EE45825 for ; Thu, 26 Mar 2020 06:58:33 +0000 (UTC) X-FDA: 76636610106.26.rod23_84dd069ad940c X-HE-Tag: rod23_84dd069ad940c X-Filterd-Recvd-Size: 3928 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Mar 2020 06:58:32 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id a81so5745786wmf.5 for ; Wed, 25 Mar 2020 23:58:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WNr+H+i2h9AKUcba1Al2JvL3xo1ZLSPUjZ6Kc7JA57I=; b=I7c8hYOHRDuqXJ4EVekf/LSX8qV6bBKdU3nl4ixrXGAD9fyG2OEXBJIBmVeK3q/Orq U5nh5tfHWcnDFDoIqiLlrdSL8n/9ykV68SuFcPxsUtm6nbo2btdsTRgkCFp2GIlIFNp6 3JB7gUyTBN8pR9bCw3RT1LjDqJsQJQzdWlP1h5I4fsBTSDw/KMXx1RjpuBcjZH8ixCrL 5GZjSVfYdYhKDHookdh6BDo4jwAoeRJgSoqIO9zANr94BMhN9fz+Ny8vbl7cgePFtEZK 2D3r3HgaONsMykSbIERZhl/0dGLBCWWZzQt6Gf2+FsQ/R6N5X1oQd188wLVA203KBsh3 3vgw== X-Gm-Message-State: ANhLgQ2n0w/6h9GmayVP0aYVhVP2skFPZpb7A4lqlEakL72OuTHp481e X1g6tZYnHzel8ca29vKMpbE= X-Google-Smtp-Source: ADFU+vscvykjE0LsujRNMqBRjiwR5Fy2NQHMrSKyT3k1ZjEPNd/kX6YIOUXuoXPIPKLQTlTuYWhhxg== X-Received: by 2002:a1c:b7c2:: with SMTP id h185mr1554055wmf.67.1585205911614; Wed, 25 Mar 2020 23:58:31 -0700 (PDT) Received: from localhost (ip-37-188-135-150.eurotel.cz. [37.188.135.150]) by smtp.gmail.com with ESMTPSA id a192sm2287562wme.5.2020.03.25.23.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 23:58:30 -0700 (PDT) Date: Thu, 26 Mar 2020 07:58:29 +0100 From: Michal Hocko To: "Eric W. Biederman" Cc: Vlastimil Babka , Luis Chamberlain , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-mm@kvack.org, Ivan Teterevkov , David Rientjes , Matthew Wilcox , "Guilherme G . Piccoli" Subject: Re: [RFC v2 1/2] kernel/sysctl: support setting sysctl parameters from kernel command line Message-ID: <20200326065829.GC27965@dhcp22.suse.cz> References: <20200325120345.12946-1-vbabka@suse.cz> <874kuc5b5z.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874kuc5b5z.fsf@x220.int.ebiederm.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 25-03-20 17:20:40, Eric W. Biederman wrote: > Vlastimil Babka writes: [...] > > + if (strncmp(param, "sysctl.", sizeof("sysctl.") - 1)) > > + return 0; > > Is there any way we can use a slash separated path. I know > in practice there are not any sysctl names that don't have > a '.' in them but why should we artifically limit ourselves? Because this is the normal userspace interface? Why should it be any different from calling sysctl? [...] > Further it will be faster to lookup the sysctls using the code from > proc_sysctl.c as it constructs an rbtree of all of the entries in > a directory. The code might as well take advantage of that for large > directories. Sounds like a good fit for a follow up patch to me. Let's make this as simple as possible for the initial version. But up to Vlastimil of course. [...] > Hmm. There is a big gotcha in here and I think it should be mentioned. > This code only works because no one has done set_fs(KERNEL_DS). Which > means this only works with strings that are kernel addresses essentially > by mistake. A big fat comment documenting why it is safe to pass in > kernel addresses to a function that takes a "char __user*" pointer > would be very good. Agreed -- Michal Hocko SUSE Labs