xiaoxiang781216 commented on code in PR #6193: URL: https://github.com/apache/incubator-nuttx/pull/6193#discussion_r863726147
########## include/nuttx/arch.h: ########## @@ -1185,6 +1185,44 @@ int up_addrenv_attach(FAR struct task_group_s *group, FAR struct tcb_s *tcb); int up_addrenv_detach(FAR struct task_group_s *group, FAR struct tcb_s *tcb); #endif +/**************************************************************************** + * Name: up_addrenv_text_enable_write + * + * Description: + * Temporarily enable write access to the .text section. This must be + * called prior to loading the process code into memory. + * + * Input Parameters: + * addrenv - The address environment to be modified. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_ADDRENV +int up_addrenv_text_enable_write(FAR group_addrenv_t *addrenv); Review Comment: Since it's very useful to modify the permission of a memory region in other case(e.g. mprotect/mmap). Could you generalize arch api like this(https://man7.org/linux/man-pages/man2/mprotect.2.html): ``` int up_addrenv_protect(FAR group_addrenv_t *addrenv, FAR void *addr, size_t len, int prot); ``` and call this function from binfmt instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
