From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754419AbcI2GZU (ORCPT ); Thu, 29 Sep 2016 02:25:20 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:38800 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753513AbcI2GZO (ORCPT ); Thu, 29 Sep 2016 02:25:14 -0400 Date: Thu, 29 Sep 2016 08:25:10 +0200 From: Ingo Molnar To: Jann Horn Cc: security@kernel.org, Alexander Viro , Paul Moore , Stephen Smalley , Eric Paris , James Morris , "Serge E. Hallyn" , Nick Kralevich , Janis Danisevskis , linux-security-module@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] mm: add LSM hook for writes to readonly memory Message-ID: <20160929062510.GB21794@gmail.com> References: <1475103281-7989-1-git-send-email-jann@thejh.net> <1475103281-7989-3-git-send-email-jann@thejh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1475103281-7989-3-git-send-email-jann@thejh.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jann Horn wrote: > +/* > + * subject_cred must be the subjective credentials using which access is > + * requested. > + * object_cred must be the objective credentials of the target task at the time > + * the mm_struct was acquired. > + * Both of these may be NULL if FOLL_FORCE is unset or FOLL_WRITE is unset. Hm, I have trouble parsing the first sentence. > - return __get_user_pages_locked(current, current->mm, start, nr_pages, > - write, force, pages, vmas, NULL, false, > - FOLL_TOUCH); > + return __get_user_pages_locked(current, current->mm, current_cred(), > + current_real_cred(), start, > + nr_pages, write, force, pages, vmas, > + NULL, false, FOLL_TOUCH); So the parameter passing was disgustig before, and now it became super disgusing! Would it improve the code if we added a friendly helper structure (or two if that's better) to clean up all the interactions within these various functions? Thanks, Ingo