Re: [PATCH v2] riscv: probes: reject kprobes inside LR/SC sequences

Nam Cao <[email protected]>
Newsgroups org.infradead.lists.linux-riscv
Message-ID <[email protected]>
Xiaofeng Yuan <[email protected]> writes:
> +/*
> + * A trap taken in the middle of an LR/SC sequence clears the load
> + * reservation, so an SC following the probed instruction would always
> + * fail and the enclosing retry loop would re-enter the breakpoint.
> + * Reject probes inside such a sequence.
> + *
> + * A constrained LR/SC loop (Zalrsc) must be contained within a 64-byte
> + * contiguous region of memory and comprise at most 16 instructions.
> + * Both bounds hold regardless of the C extension, so scanning back
> + * 64 bytes from the probed instruction always covers the enclosing
> + * sequence.
> + */
> +#define MAX_ATOMIC_CONTEXT_SIZE	64

Instead of 64 bytes, can we just do 16 instructions?

And instead of finding the start address to scan and then do a forward
scan, doing a backward scan of 16 instructions is probably cleaner and
more efficient?

Nam

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.