All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nam Cao <namcao@linutronix.de>
To: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-riscv@lists.infradead.org, yuanxiaofeng@eswincomputing.com
Subject: Re: [PATCH v2] riscv: probes: reject kprobes inside LR/SC sequences
Date: Tue, 25 Aug 2026 09:02:07 +0200	[thread overview]
Message-ID: <87v78y7keo.fsf@yellow.woof> (raw)
In-Reply-To: <20260822105303.2043-1-yuanxiaofeng@eswincomputing.com>

Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com> 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
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

      reply	other threads:[~2026-08-25  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22 10:53 [PATCH v2] riscv: probes: reject kprobes inside LR/SC sequences Xiaofeng Yuan
2026-08-25  7:02 ` Nam Cao [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=87v78y7keo.fsf@yellow.woof \
    --to=namcao@linutronix.de \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=yuanxiaofeng@eswincomputing.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.