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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 0C663C43381 for ; Fri, 22 Feb 2019 00:22:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9AA92083E for ; Fri, 22 Feb 2019 00:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726228AbfBVAWO (ORCPT ); Thu, 21 Feb 2019 19:22:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:35128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbfBVAWO (ORCPT ); Thu, 21 Feb 2019 19:22:14 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF0422080F; Fri, 22 Feb 2019 00:22:11 +0000 (UTC) Date: Thu, 21 Feb 2019 19:22:10 -0500 From: Steven Rostedt To: Rick Edgecombe Cc: Andy Lutomirski , Ingo Molnar , linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, Thomas Gleixner , Borislav Petkov , Nadav Amit , Dave Hansen , Peter Zijlstra , linux_dti@icloud.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, akpm@linux-foundation.org, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, will.deacon@arm.com, ard.biesheuvel@linaro.org, kristen@linux.intel.com, deneen.t.dock@intel.com Subject: Re: [PATCH v3 18/20] x86/ftrace: Use vmalloc special flag Message-ID: <20190221192210.3e038fc3@gandalf.local.home> In-Reply-To: <20190221234451.17632-19-rick.p.edgecombe@intel.com> References: <20190221234451.17632-1-rick.p.edgecombe@intel.com> <20190221234451.17632-19-rick.p.edgecombe@intel.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Thu, 21 Feb 2019 15:44:49 -0800 Rick Edgecombe wrote: > Use new flag VM_FLUSH_RESET_PERMS for handling freeing of special > permissioned memory in vmalloc and remove places where memory was set NX > and RW before freeing which is no longer needed. > > Cc: Steven Rostedt > Acked-by: Steven Rostedt (VMware) > Signed-off-by: Rick Edgecombe > --- > arch/x86/kernel/ftrace.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > index 13c8249b197f..93efe3955333 100644 > --- a/arch/x86/kernel/ftrace.c > +++ b/arch/x86/kernel/ftrace.c > @@ -692,10 +692,6 @@ static inline void *alloc_tramp(unsigned long size) > } > static inline void tramp_free(void *tramp, int size) As size is no longer used within the function, can you remove that too. Thanks, -- Steve > { > - int npages = PAGE_ALIGN(size) >> PAGE_SHIFT; > - > - set_memory_nx((unsigned long)tramp, npages); > - set_memory_rw((unsigned long)tramp, npages); > module_memfree(tramp); > } > #else > @@ -820,6 +816,8 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) > /* ALLOC_TRAMP flags lets us know we created it */ > ops->flags |= FTRACE_OPS_FL_ALLOC_TRAMP; > > + set_vm_flush_reset_perms(trampoline); > + > /* > * Module allocation needs to be completed by making the page > * executable. The page is still writable, which is a security hazard,