From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Kees Cook <keescook@chromium.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
Ralf Baechle <ralf@linux-mips.org>,
Sanjay Lal <sanjayl@kymasys.com>,
John Crispin <blogic@openwrt.org>,
linux-mips@linux-mips.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mips: export icache_flush_range
Date: Sun, 23 Mar 2014 02:41:37 +0300 [thread overview]
Message-ID: <532E1FB1.9000606@cogentembedded.com> (raw)
In-Reply-To: <CAGXu5jLUueSb2u_Ki+nEL1CaBzyZyT1+7rhCB-0ZGB0nD5cT4g@mail.gmail.com>
On 03/23/2014 12:05 AM, Kees Cook wrote:
>>>>> The lkdtm module performs tests against executable memory ranges, so
>>>>> it needs to flush the icache for proper behaviors. Other architectures
>>>>> already export this, so do the same for MIPS.
>>>>> Signed-off-by: Kees Cook <keescook@chromium.org>
>>>>> ---
>>>>> This is currently untested! I'm building a MIPS cross-compiler now...
>>>>> If someone can validate this fixes the build when lkdtm is a module,
>>>>> that would be appreciated. :)
>>>>> ---
>>>>> arch/mips/mm/cache.c | 1 +
>>>>> 1 file changed, 1 insertion(+)
>>>>> diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
>>>>> index fde7e56d13fe..b3f1df13d9f6 100644
>>>>> --- a/arch/mips/mm/cache.c
>>>>> +++ b/arch/mips/mm/cache.c
>>>>> @@ -38,6 +38,7 @@ void (*__flush_kernel_vmap_range)(unsigned long vaddr,
>>>>> int
>>>>> size);
>>>>> void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);
>>>>>
>>>>> EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
>>>>> +EXPORT_SYMBOL_GPL(flush_icache_range);
>>>> Have you run this thru scripts/checkpatch.pl? It would have told you
>>>> that
>>>> an export should immediately follow the corresponding function body,
>>>> AFAIK.
>>> Hm, it doesn't now but definitely used to...
>> Decided to check Documentation/CodingStyle, and it still codifies this:
>> In source files, separate functions with one blank line. If the function is
>> exported, the EXPORT* macro for it should follow immediately after the
>> closing
>> function brace line. E.g.:
>> int system_is_up(void)
>> {
>> return system_state == SYSTEM_RUNNING;
>> }
>> EXPORT_SYMBOL(system_is_up);
> Yup, thanks. I know the style, but it seemed from the source file that
> the style was to declare the function pointers in bulk, and then
> explicitly export them in the next section, so I continued that style.
> For example:
> void (*flush_cache_sigtramp)(unsigned long addr);
> void (*local_flush_data_cache_page)(void * addr);
> void (*flush_data_cache_page)(unsigned long addr);
> void (*flush_icache_all)(void);
> EXPORT_SYMBOL_GPL(local_flush_data_cache_page);
> EXPORT_SYMBOL(flush_data_cache_page);
> EXPORT_SYMBOL(flush_icache_all);
> Regardless, I'm happy to stick it in the middle of the function
> pointers if that's preferred.
Ah, that's a variable! I didn't realize that. Looking into checkpatch.pl,
it should warn about variables as well though... but it doesn't.
> -Kees
WBR, Sergei
prev parent reply other threads:[~2014-03-22 22:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-22 15:47 [PATCH] mips: export icache_flush_range Kees Cook
2014-03-22 19:05 ` Kees Cook
2014-04-07 13:58 ` Paul Gortmaker
2014-04-07 13:58 ` Paul Gortmaker
2014-04-09 19:43 ` Kees Cook
2014-03-22 21:45 ` Sergei Shtylyov
2014-03-22 21:48 ` Sergei Shtylyov
2014-03-22 21:54 ` Sergei Shtylyov
2014-03-22 21:05 ` Kees Cook
2014-03-22 23:41 ` Sergei Shtylyov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532E1FB1.9000606@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=blogic@openwrt.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=paul.gortmaker@windriver.com \
--cc=ralf@linux-mips.org \
--cc=sanjayl@kymasys.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox