Messages in this thread | | | Date | Wed, 11 Apr 2018 11:29:56 +0200 (CEST) | From | Miroslav Benes <> | Subject | Re: [PATCH v2 1/2] livepatch: Initialize shadow variables safely by a custom callback |
| |
On Thu, 5 Apr 2018, Petr Mladek wrote:
> The existing API allows to pass a sample data to initialize the shadow > data. It works well when the data are position independent. But it fails > miserably when we need to set a pointer to the shadow structure itself. > > Unfortunately, we might need to initialize the pointer surprisingly > often because of struct list_head. It is even worse because the list > might be hidden in other common structures, for example, struct mutex, > struct wait_queue_head. > > For example, this was needed to fix races in ALSA sequncer. It required
s/sequncer/sequencer/
> to add mutex into struct snd_seq_client. See commit b3defb791b26ea06 > ("ALSA: seq: Make ioctls race-free") and commit d15d662e89fc667b9 > ("ALSA: seq: Fix racy pool initializations") > > This patch makes the API more safe. A custom constructor function and data > are passed to klp_shadow_*alloc() functions instead of the sample data. > > Note that ctor_data are not longer a template for shadow->data. It might
s/not longer/no longer/
> point to any data that might be necessary when the constructor is called.
Miroslav
| |