# Re: \[PATCH\] vsprintf: Do not break early boot with probing addresses

- From: Michal Suchánek \<hidden\>
- Date: 2019-05-09 13:38:33 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2019/05/5592905
- Thread: https://ratatoskr.run/linux-arch/2019/05/5592853/t.md

```text
On Thu,  9 May 2019 14:19:23 +0200
Petr Mladek [ref] wrote:

> The commit 3e5903eb9cff70730 ("vsprintf: Prevent crash when dereferencing
> invalid pointers") broke boot on several architectures. The common
> pattern is that probe_kernel_read() is not working during early
> boot because userspace access framework is not ready.
> 
> The check is only the best effort. Let's not rush with it during
> the early boot.
> 
> Details:
> 
> 1. Report on Power:
> 
> Kernel crashes very early during boot with with CONFIG_PPC_KUAP and
> CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
> 
> The problem is the combination of some new code called via printk(),
> check_pointer() which calls probe_kernel_read(). That then calls
> allow_user_access() (PPC_KUAP) and that uses mmu_has_feature() too early
> (before we've patched features).

There is early_mmu_has_feature for this case. mmu_has_feature does not
work before patching so parts of kernel that can run before patching
must use the early_ variant which actually runs code reading the
feature bitmap to determine the answer.

Thanks

Michal
```
