Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18380785ybl; Fri, 3 Jan 2020 00:57:32 -0800 (PST) X-Google-Smtp-Source: APXvYqz4TFkmZJ5jZvpsI0YB/YwLr0SQkX6eM9UNEqxhj307XeXUGWTv8VdE95i9EH/WGiRhSP8h X-Received: by 2002:a9d:4d8d:: with SMTP id u13mr94501887otk.299.1578041852154; Fri, 03 Jan 2020 00:57:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578041852; cv=none; d=google.com; s=arc-20160816; b=S+YjPEBnrvG9yCpkw2vfbTbCjgrvjPq4VXuMtYLVX8DELJblZoHc3tHW8VL4DiHosn 3h0vDQWSG1vfP2rhj77Cye99CM+9fxCmUGu1llFCzh1IQ9mc3wMAm4y3dijSTujOmpIL RtUn6+jiL1PvCaHdKOHhc7cm2ayTijE/SggkA04XZKw+s5ACzi5eop2d1DfPHCbrZanV aivEK0TdC+EyC7upzjA7871HnyDR/o0Chr6w3Ak5Vpp5UwXb2HwDRS+KP1Xo2yjKQkK/ MNLEwpN9W3mXT8369EHgWkiZ8bkiaGUfF1zZCGkmeq552TbjIQQMUU71fEt/2dZe4obY 3v+w== 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-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=0Z1ilc08hFnHdm81knu5B1H8kg3ChTXipiSRGf2VoSM=; b=zOySd3MvEUKrhpkmtmjn9kQ5xD5P0yrh9qpZ0NytiexCN4L9isn7GwDJ1yoGhnqC+9 nWoQ5NhR8FicLTPywE4rVtp72c56pHfGH/7tYTNYgPu0xUL+N7yPchMkod4saP4k5gX2 ciTt7ONApjPGPfitEFGHnWAVn97afqRbhlexA+d8aDMzJ9b63biyq3F8Q7wUIuvp7hKL 0H3hk43XUgCu+qdyxZK0WfoX9DZ2lBAZ6fspdMT/aJkxQz+VsAswHMhscEskulCG2BTj 28tfeZHjeFc7eSCTdyD7j5UlEYGIfsqw34RL407fyzy08waosc3nmtlFx0SJB/gM2Vjv R04A== 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 g93si31641395otg.231.2020.01.03.00.57.19; Fri, 03 Jan 2020 00:57:32 -0800 (PST) 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 S1727313AbgACI4m (ORCPT + 99 others); Fri, 3 Jan 2020 03:56:42 -0500 Received: from monster.unsafe.ru ([5.9.28.80]:41362 "EHLO mail.unsafe.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgACI4m (ORCPT ); Fri, 3 Jan 2020 03:56:42 -0500 Received: from comp-core-i7-2640m-0182e6 (nat-pool-brq-t.redhat.com [213.175.37.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.unsafe.ru (Postfix) with ESMTPSA id 65FB8C61AF3; Fri, 3 Jan 2020 08:56:36 +0000 (UTC) Date: Fri, 3 Jan 2020 09:56:34 +0100 From: Alexey Gladkov To: J Freyensee 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" , "Eric W . Biederman" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Linus Torvalds , Oleg Nesterov , Solar Designer , Stephen Rothwell Subject: Re: [PATCH v6 07/10] proc: flush task dcache entries from all procfs instances Message-ID: <20200103085634.6xkgb4aonivjhfnq@comp-core-i7-2640m-0182e6> Mail-Followup-To: J Freyensee , 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" , "Eric W . Biederman" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Linus Torvalds , Oleg Nesterov , Solar Designer , Stephen Rothwell References: <20191225125151.1950142-1-gladkov.alexey@gmail.com> <20191225125151.1950142-8-gladkov.alexey@gmail.com> <8d85ba43-0759-358e-137d-246107bac747@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8d85ba43-0759-358e-137d-246107bac747@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 30, 2019 at 02:03:29PM -0800, J Freyensee wrote: > > +#ifdef CONFIG_PROC_FS > > +static inline void pidns_proc_lock(struct pid_namespace *pid_ns) > > +{ > > + down_write(&pid_ns->rw_proc_mounts); > > +} > > + > > +static inline void pidns_proc_unlock(struct pid_namespace *pid_ns) > > +{ > > + up_write(&pid_ns->rw_proc_mounts); > > +} > > + > > +static inline void pidns_proc_lock_shared(struct pid_namespace *pid_ns) > > +{ > > + down_read(&pid_ns->rw_proc_mounts); > > +} > > + > > +static inline void pidns_proc_unlock_shared(struct pid_namespace *pid_ns) > > +{ > > + up_read(&pid_ns->rw_proc_mounts); > > +} > > +#else /* !CONFIG_PROC_FS */ > > + > Apologies for my newbie question. I couldn't help but notice all these > function calls are assuming that the parameter struct pid_namespace *pid_ns > will never be NULL.? Is that a good assumption? These inline helpers are introduced to improve readability. They only make sense inside procfs. I don't think that defensive programming is useful here. -- Rgrds, legion