ARM/clkdev fixes for v6.10

- Fix clkdev - erroring out on long strings causes boot failures, so
   don't do this. Still warn about the over-sized strings (which will
   never match and thus their registration with clkdev is useless.)
 
 - Fix for ftrace with frame pointer unwinder with recent GCC changing
   the way frames are stacked.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEuNNh8scc2k/wOAE+9OeQG+StrGQFAmZm34EACgkQ9OeQG+St
 rGTFpRAAivJ0AigfOr4AX4t+50UkijqNHSkCWkNL00mXzLDJfiFa2nSeIqb0oW3u
 lzpCzBbnFgtTFu9j6T96dRJFBsZL6+Bmw9SIxkT1rsjG3tsExajETINAJrYmuXJ/
 VxgY9k+xl/3XDKAPE0zAlcadvC/lnl4yxVduRaTK++0RZN3M/zM241anZWJs7hFb
 yzpaf1hfcCFd5objz29uBhJMtJWl6EVl6y2XOQPvAa5mXTRNxu5kXP0WwaetdCNM
 GyxOmdskXrqQRC1LU/UyX2g1vtIJbmHAEXMgqzHAkV+uiLt98A/AKe7NzoV/2zI7
 +2PZM3LHXlwkv7PUBR2B8/CYD0448btjK+3fdRK0Ck8QpvE29yHukrA2zS2f2vTh
 L3cFJZYNThDycAZUMX7hGum4Xe/l6fCqMnmLlyFidTWkWx+tawtRQNQB6VVDEzrM
 +iqRbSMTZ3uDH4IBnXigS1KcZG/444EzcSB3e4zeVP5yH+AJ5xJG/itG/mvT10zE
 214eg3C+hSUgm40s+juykty+lyggJwNxYYLu0mSLMYl+gu224s/N4nsE4Gb+7Lvn
 iw4TtK0XNOkZ3VQ+M+XOYBu3nRZON37P91BYs692TgbfN/xreccoWujY2dIwx1s/
 e8izgnDqQOovXVP8zKyTvD0THXSMIwIcwxD49Hudxhsfpyi5dfw=
 =2Kpc
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rmk/linux

Pull ARM and clkdev fixes from Russell King:

 - Fix clkdev - erroring out on long strings causes boot failures, so
   don't do this. Still warn about the over-sized strings (which will
   never match and thus their registration with clkdev is useless)

 - Fix for ftrace with frame pointer unwinder with recent GCC changing
   the way frames are stacked.

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rmk/linux:
  ARM: 9405/1: ftrace: Don't assume stack frames are contiguous in memory
  clkdev: don't fail clkdev_alloc() if over-sized
This commit is contained in:
Linus Torvalds 2024-06-12 16:58:05 -07:00
commit 2ccbdf43d5
2 changed files with 24 additions and 4 deletions

View file

@ -232,11 +232,24 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
unsigned long old;
if (unlikely(atomic_read(&current->tracing_graph_pause)))
err_out:
return;
if (IS_ENABLED(CONFIG_UNWINDER_FRAME_POINTER)) {
/* FP points one word below parent's top of stack */
frame_pointer += 4;
/*
* Usually, the stack frames are contiguous in memory but cases
* have been observed where the next stack frame does not live
* at 'frame_pointer + 4' as this code used to assume.
*
* Instead, dereference the field in the stack frame that
* stores the SP of the calling frame: to avoid unbounded
* recursion, this cannot involve any ftrace instrumented
* functions, so use the __get_kernel_nofault() primitive
* directly.
*/
__get_kernel_nofault(&frame_pointer,
(unsigned long *)(frame_pointer - 8),
unsigned long, err_out);
} else {
struct stackframe frame = {
.fp = frame_pointer,

View file

@ -204,8 +204,15 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
pr_err("%pV:%s: %s ID is greater than %zu\n",
&vaf, con_id, failure, max_size);
va_end(ap_copy);
kfree(cla);
return NULL;
/*
* Don't fail in this case, but as the entry won't ever match just
* fill it with something that also won't match.
*/
strscpy(cla->con_id, "bad", sizeof(cla->con_id));
strscpy(cla->dev_id, "bad", sizeof(cla->dev_id));
return &cla->cl;
}
static struct clk_lookup *