Thread (8 messages) 8 messages, 3 authors, 2025-09-08

Re: [PATCH] firmware: arm_scmi: quirk: fix write to string constant

From: Cristian Marussi <cristian.marussi@arm.com>
Date: 2025-08-29 21:13:42
Also in: arm-scmi, lkml, stable

On Fri, Aug 29, 2025 at 03:21:52PM +0200, Johan Hovold wrote:
The quirk version range is typically a string constant and must not be
modified (e.g. as it may be stored in read-only memory):

	Unable to handle kernel write to read-only memory at virtual
	address ffffc036d998a947

Fix the range parsing so that it operates on a copy of the version range
string, and mark all the quirk strings as const to reduce the risk of
introducing similar future issues.
Hi,

indeed when implementing this I was a bit doubtful about the in-place
overwrite approach that I used during the ranges parsing...but since
each quirk was indeed initialized once and its range parsed once, it
seemed fair to use the string itself as a sort of scratch area while
parsing it into integers and avoid the local copy...just I haven't
considered the possibility that such strings could be stored in a RO
segment...and I got no error on my setup....

Anyway, good catch, it is certainly better to operate on a copy.

LGTM.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help