Conversation
Edited 11 months ago
Booting the latest kernel is always fun ;)

I was hit by BUG_ON() because I enabled CONFIG_DEBUG_VIRTUAL=y.
It made my machine crash and I wrote and sent a quick hack to fix this.

https://lore.kernel.org/lkml/CAB=+i9QiJ=BXkQuCFJTh3dMXrkKQvVA2EM51Mj6SsDMimWQ71g@mail.gmail.com

Today I learned:

- Better to use proper tags for regzbot next time I report something, don't make @kernellogger do that instead of me.

- __init and __exit are compiler attributes that makes functions to be in specific ELF sections (.init.text and .exit.text), to drop portions of unused kernel code.

- When a kernel feature is built into kernel rather than built as a module, functions marked __init are dropped after initialization and functions marked __exit are dropped and never used. because you can't unload a built-in kernel feature ;)

- Some architectures drop .exit.text section at link time, but some drop at runtime. this is due to complexity of link-time reference counting between functions (? which I have no idea yet)

- On architectures that drop it at runtime, functions marked __exit are dropped in free_initmem() because .exit.text section is between __init_begin and __init_end.

- I need an automatic bisection system to save time in the future.

One piece of information I'm missing here is why it did not crash before the commit :(
2
0
4

@hyeyoo

getting regzbot involved is much appreciated, but don't worry, I can handle that, I do that all the time.

Good to see that a fix is getting closer to being fully formed & mainlined.

And thx for reporting!

0
0
2
@ljs @kernellogger
it won't land on the mainline ;)
(the consensus seems to be not using static calls in __exit)
but was fun!
0
0
2