zsmalloc: calling zs_map_object() from irq is a bug
Subsystems (2)
PATCH 1/1 zsmalloc: calling zs_map_object() from irq is a bug
Use BUG_ON(in_interrupt()) in zs_map_object(). Calling this function from IRQ is a bug, because we use per-CPU mappings and interrupt may corrupt those buffers.
--- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zsmalloc.c +1 -1
@@ -1349,7 +1349,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,* pools/users, we can't allow mapping in interrupt context * because it can corrupt another users mappings. */ -WARN_ON_ONCE (in_interrupt ()); +BUG_ON (in_interrupt ());/* From now on, migration cannot move the object */ pin_tag (handle);
Signature · 1 line
2.14.1
Quoted 5 lines · Sergey Senozhatsky
Use BUG_ON(in_interrupt()) in
zs_map_object(). Calling this function from IRQ is a bug, because we use per-CPU mappings and interrupt may corrupt those buffers.Signed-off-by Sergey Senozhatsky <[email protected]>
IMHO, corruption the buffer would be not enough to be a BUG_ON which stop the system fully so user loses any chances to shut down smooth/hunt it down.
More serious thing of our case is that it can leak other user's data by overwriting, which is more concern I am thinking now.
So,
Thanks!
Quoted 11 lines · Minchan Kim
Quoted 5 lines · Sergey Senozhatsky
Use BUG_ON(in_interrupt()) in
zs_map_object(). Calling this function from IRQ is a bug, because we use per-CPU mappings and interrupt may corrupt those buffers.Signed-off-by Sergey Senozhatsky <[email protected]>IMHO, corruption the buffer would be not enough to be a
BUG_ONwhich stop the system fully so user loses any chances to shut down smooth/hunt it down.
Quoted 6 lines
More serious thing of our case is that it can leak other user's data by overwriting, which is more concern I am thinking now.
So,
Acked-by Minchan Kim <[email protected]>
thanks.
-ss
Andrew Morton
maintainerQuoted 5 lines · On Wed, 20 Sep 2017 15:47:39 +0900 Minchan Kim <[email protected]> wrote:
Quoted 4 lines · Sergey Senozhatsky
Use BUG_ON(in_interrupt()) in
zs_map_object(). Calling this function from IRQ is a bug, because we use per-CPU mappings and interrupt may corrupt those buffers.
Quoted 9 lines
Quoted 1 line
Signed-off-by Sergey Senozhatsky <[email protected]>IMHO, corruption the buffer would be not enough to be a
BUG_ONwhich stop the system fully so user loses any chances to shut down smooth/hunt it down.More serious thing of our case is that it can leak other user's data by overwriting, which is more concern I am thinking now.
In an off-list email Linus has basically stated that all new uses of BUG_ON should include words in the changelog or code comments explaining why it is justifiable to kill the machine when the condition triggers.
So can we please have a v2 with the appropriate comment?
Quoted 15 lines · Andrew Morton
Quoted 5 lines · Sergey Senozhatsky
Quoted 4 lines
Use BUG_ON(in_interrupt()) in
zs_map_object(). Calling this function from IRQ is a bug, because we use per-CPU mappings and interrupt may corrupt those buffers.Quoted 9 lines
Quoted 1 line
Signed-off-by Sergey Senozhatsky <[email protected]>IMHO, corruption the buffer would be not enough to be a
BUG_ONwhich stop the system fully so user loses any chances to shut down smooth/hunt it down.More serious thing of our case is that it can leak other user's data by overwriting, which is more concern I am thinking now.
Quoted 6 lines
In an off-list email Linus has basically stated that all new uses of
BUG_ONshould include words in the changelog or code comments explaining why it is justifiable to kill the machine when the condition triggers.So can we please have a v2 with the appropriate comment?
ah, OK. will follow up.
-ss