Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265243

Re: [PATCH v2 2/3] module: Use the same logic for setting and unsetting RO/NX

From Rusty Russell <rusty@rustcorp.com.au>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/3] module: Use the same logic for setting and unsetting RO/NX
Date 2015-11-09 00:00 +0100
Message-ID <qsH6i-6m1-11@gated-at.bofh.it> (permalink)
References <qrA6R-3va-3@gated-at.bofh.it> <qrA6R-3va-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Josh Poimboeuf <jpoimboe@redhat.com> 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/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 2/3] module: Use the same logic for setting and unsetting RO/NX Josh Poimboeuf <jpoimboe@redhat.com> - 2015-11-05 22:20 +0100
  Re: [PATCH v2 2/3] module: Use the same logic for setting and unsetting RO/NX Rusty Russell <rusty@rustcorp.com.au> - 2015-11-09 00:00 +0100

csiph-web