Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1708573ybb; Thu, 9 Apr 2020 07:35:37 -0700 (PDT) X-Google-Smtp-Source: APiQypK9zD9IE2En4yGcRZ+pKeOHEQk0v11XRf5ZFG/14l2rX/xNaxTX8y8n2fs2pMoM3UPtavx2 X-Received: by 2002:a37:af86:: with SMTP id y128mr55008qke.429.1586442937098; Thu, 09 Apr 2020 07:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586442937; cv=none; d=google.com; s=arc-20160816; b=jNtfyIqd5DefBRO24kAm1/mDeYjcfGpzNQy+D9JyoLriYUoR/SCid4LckjvbYE9vFQ o9eubzxx0zFcaUjkYCj9fLkjfUjvNzqmvRJvcuiARTa0h12sMxDc3Li0pjrdkQoTRQIC kP/UMjDlofu8ojT+VHjMZEi43fKlTDnjur1vA03Y7n7jmE7kyhZBbwbmxSgGcPDPYuzv gqkF6PvgxB6QfXj0HCZsbqtHdRf/Bl0PJ91qFrHNzzXLa4HGaaEE0rZBLpb2GiT8TfC2 ZYlqul+Wirk6UUpRa4FVD7YG2OB/8NUAXZ2gTFe2J9rK4HxqmgLb1eatYUB84o3WaeXj V30g== 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; bh=6sJeyJA+FpiFplKOfbno2aFeNmpr5YxeTzDLbJpVl3U=; b=J8Q5MbzRUdBwFcoh+ZuUYpJmVLmtkPfsPZdMcfc7/id0eN0bIoBbuT9X3ttoYLijkh r4kNIFRBl6yRD9XnuTREa3T7tuOqIlwa6Ac0C92QNN55ISwYwWPkJT7P6pQqTj+W7phm 3i3F75LTzcBYWv4RGgvOaBk1H4bVcVDIoSsZns2q1+Lq1z39mgyPoMvOliOru2U/yikH 65qD8dtg+/uUicecJM/0UR6HZGZAvsvot/G6gNOOA5nanmYV3E8UF41uyK2i+uLXFbMK jXOeYwqgduIBlvGHfxYQ7O+6m9tkZjgPZ54GN/Xzcuqmz1ClOzjOPcQ/YBfBFfWzNXlY e4lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a26si1875806qko.258.2020.04.09.07.35.07; Thu, 09 Apr 2020 07:35:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727771AbgDIOdJ (ORCPT + 99 others); Thu, 9 Apr 2020 10:33:09 -0400 Received: from raptor.unsafe.ru ([5.9.43.93]:45052 "EHLO raptor.unsafe.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727368AbgDIOdI (ORCPT ); Thu, 9 Apr 2020 10:33:08 -0400 Received: from comp-core-i7-2640m-0182e6 (ip-89-102-33-211.net.upcbroadband.cz [89.102.33.211]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by raptor.unsafe.ru (Postfix) with ESMTPSA id 9128E209C3; Thu, 9 Apr 2020 14:32:56 +0000 (UTC) Date: Thu, 9 Apr 2020 16:32:51 +0200 From: Alexey Gladkov To: "Eric W. Biederman" Cc: LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexander Viro , Alexey Dobriyan , Andrew Morton , Andy Lutomirski , Daniel Micay , Djalal Harouni , "Dmitry V . Levin" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Linus Torvalds , Oleg Nesterov , David Howells Subject: Re: [PATCH v10 8/9] proc: use human-readable values for hidehid Message-ID: <20200409143251.pqoprbjnetoup5vw@comp-core-i7-2640m-0182e6> References: <20200327172331.418878-1-gladkov.alexey@gmail.com> <20200327172331.418878-9-gladkov.alexey@gmail.com> <87d08pkh4u.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d08pkh4u.fsf@x220.int.ebiederm.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.1 (raptor.unsafe.ru [5.9.43.93]); Thu, 09 Apr 2020 14:33:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 02, 2020 at 11:05:21AM -0500, Eric W. Biederman wrote: > Alexey Gladkov writes: > > > The hidepid parameter values are becoming more and more and it becomes > > difficult to remember what each new magic number means. > > In principle I like this change. In practice I think you have just > broken ABI compatiblity with the new mount ABI. > > In particular the following line seems broken. > > > diff --git a/fs/proc/root.c b/fs/proc/root.c > > index dbcd96f07c7a..ba782d6e6197 100644 > > --- a/fs/proc/root.c > > +++ b/fs/proc/root.c > > @@ -45,7 +45,7 @@ enum proc_param { > > > > static const struct fs_parameter_spec proc_fs_parameters[] = { > > fsparam_u32("gid", Opt_gid), > > - fsparam_u32("hidepid", Opt_hidepid), > > + fsparam_string("hidepid", Opt_hidepid), > > fsparam_string("subset", Opt_subset), > > {} > > }; > > As I read fs_parser.c fs_param_is_u32 handles string inputs and turns them > into numbers, and it handles binary numbers. Yes, you can use: fsconfig(fsfd, FSCONFIG_SET_BINARY, ...); but in this case the type of parameter will be fs_value_is_blob [1]. This kind of parameters is handled by fs_param_is_blob(). The fs_param_is_u32 can handle only parametes with fs_value_is_string type [2]. Am I missing something? [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/fsopen.c#n405 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/fs_parser.c#n215 > However fs_param_is_string > appears to only handle strings. It appears to have not capacity to turn > raw binary numbers into strings. > > So I think we probably need to fix fs_param_is_string to raw binary > numbers before we can safely make this change to fs/proc/root.c > > David am I reading the fs_parser.c code correctly? If I am are you ok > with a change like the above? > > Eric > -- Rgrds, legion