Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751623AbbKHWum (ORCPT ); Sun, 8 Nov 2015 17:50:42 -0500 Received: from ozlabs.org ([103.22.144.67]:40962 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750791AbbKHWuk (ORCPT ); Sun, 8 Nov 2015 17:50:40 -0500 From: Rusty Russell To: Josh Poimboeuf , Seth Jennings , Jiri Kosina , Vojtech Pavlik Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, "Cyril B." , Miroslav Benes Subject: Re: [PATCH v2 2/3] module: Use the same logic for setting and unsetting RO/NX In-Reply-To: References: User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 09 Nov 2015 06:10:45 +1030 Message-ID: <87d1vk2saq.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1314 Lines: 38 Josh Poimboeuf writes: > When setting a module's RO and NX permissions, set_section_ro_nx() is > used, but when clearing them, unset_module_{init,core}_ro_nx() are used. > The unset functions don't have the same checks the set function has for > partial page protections. It's probably harmless, but it's still > confusingly asymmetrical. > > Instead, use the same logic to do both. Also add some new > set_module_{init,core}_ro_nx() helper functions for more symmetry with > the unset functions. Yes, this seems sensible. One nit to pick: > + unsigned long total_size, > + int (*set_ro)(unsigned long start, int num_pages), > + int (*set_nx)(unsigned long start, int num_pages)) ... > + set_section_ro_nx(mod->module_core, mod->core_text_size, > + mod->core_ro_size, mod->core_size, > + set_memory_rw, set_memory_x); set_ro == set_memory_rw here. That's just confusing. I think we have to avoid the word "set" in the function parameters since it may unset instead. Suggest "alter_ro" or "frob_ro" instead? Thanks, Rusty. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/