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


Groups > linux.kernel > #1545324

Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation
Date 2016-12-20 19:00 +0100
Message-ID <sQwRH-fa-9@gated-at.bofh.it> (permalink)
References <sNSOJ-7j-13@gated-at.bofh.it> <sQnv4-2G0-21@gated-at.bofh.it> <sQsl3-60s-13@gated-at.bofh.it> <sQuwy-7jd-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 12/20, Marcin Nowakowski wrote:
>
> Hi Oleg,
>
> On 20.12.2016 14:08, Oleg Nesterov wrote:
>> On 12/19, tip-bot for Marcin Nowakowski wrote:
>>>
>>> uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation
>>>
>>> Commit:
>>>
>>>   72e6ae285a1d ('ARM: 8043/1: uprobes need icache flush after xol write'
>>>
>>> ... has introduced an arch-specific method to ensure all caches are
>>> flushed appropriately after an instruction is written to an XOL page.
>>
>> when this page is already mmaped,
>>
>>> However, when the XOL area is created and the out-of-line breakpoint
>>> instruction is copied, caches are not flushed at all and stale data may
>>> be found in icache.
>>
>> but in this case the page is not mmaped yet, the probed application will
>> take a page fault if it tries to execute this insn,
>
> In case of MIPS (and AFAICT ARM as well, and these are the only  
> architectures that implement arch_uprobe_copy_ixol), the cache flushing  
> is done through the kernel addresses of that page, so the fact that it  
> is not mapped yet is not an issue.

OK, thanks,

> Do I understand correctly that your statement implies that after the  
> page fault and mmapping the xol page, the page is guaranteed to be  
> updated in the cache? As definitely that is not something that is  
> happening at the moment.

Well, I do not know. Let me repeat I don't understand this flush_.*cache
magic.

But. do_read_fault() does

	__do_fault(..., &fault_page, ...);

	alloc_set_pte(fault_page);

and alloc_set_pte() does flush_icache_page(vma, page)... Hmm, which is nop
on MIPS.

>> OK, I know nothing about MIPS, but could you help me understand this change?
>>
>> See above. If we really need flush_icache_range() here then perhaps we should
>> modify install_special_mapping() and/or __do_fault/special_mapping_fault paths
>> instead?
>
> Are you suggesting that those should be updated to force a cache update?

Again, I do not know. But perhaps it makes more sense to actually implement
flush_icache_page() ? Otherwise another user of install_special_mapping()
can hit the same problem?

Oleg.

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


Thread

[PATCH] uprobes: allow for a cache flush after ixol breakpoint creation Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2016-12-13 11:50 +0100
  [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache  flush after ixol breakpoint creation tip-bot for Marcin Nowakowski <tipbot@zytor.com> - 2016-12-20 09:00 +0100
    Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a  cache flush after ixol breakpoint creation Oleg Nesterov <oleg@redhat.com> - 2016-12-20 14:10 +0100
      Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache  flush after ixol breakpoint creation Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2016-12-20 16:30 +0100
        Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a         cache flush after ixol breakpoint creation Oleg Nesterov <oleg@redhat.com> - 2016-12-20 19:00 +0100
          Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a  cache flush after ixol breakpoint creation Ralf Baechle <ralf@linux-mips.org> - 2016-12-21 12:30 +0100

csiph-web