mbox series

[0/2] blktrace: fix trace buffer leak and limit trace buffer size

Message ID 20210323081440.81343-1-ming.lei@redhat.com (mailing list archive)
Headers show
Series blktrace: fix trace buffer leak and limit trace buffer size | expand

Message

Ming Lei March 23, 2021, 8:14 a.m. UTC
blktrace may pass big trace buffer size via '-b', meantime the system
may have lots of CPU cores, so too much memory can be allocated for
blktrace.

The 1st patch shutdown bltrace in blkdev_close() in case of task
exiting, for avoiding trace buffer leak.

The 2nd patch limits max trace buffer size for avoiding potential
OOM.


Ming Lei (2):
  block: shutdown blktrace in case of fatal signal pending
  blktrace: limit allowed total trace buffer size

 fs/block_dev.c          |  6 ++++++
 kernel/trace/blktrace.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

Comments

Ming Lei March 30, 2021, 2:04 a.m. UTC | #1
On Tue, Mar 23, 2021 at 04:14:38PM +0800, Ming Lei wrote:
> blktrace may pass big trace buffer size via '-b', meantime the system
> may have lots of CPU cores, so too much memory can be allocated for
> blktrace.
> 
> The 1st patch shutdown bltrace in blkdev_close() in case of task
> exiting, for avoiding trace buffer leak.
> 
> The 2nd patch limits max trace buffer size for avoiding potential
> OOM.
> 
> 
> Ming Lei (2):
>   block: shutdown blktrace in case of fatal signal pending
>   blktrace: limit allowed total trace buffer size
> 
>  fs/block_dev.c          |  6 ++++++
>  kernel/trace/blktrace.c | 32 ++++++++++++++++++++++++++++++++
>  2 files changed, 38 insertions(+)

Hello Guys,

Ping...

BTW, this is another OOM risk in blktrace userspace which is caused by
mlock(16 * buffer_size) * nr_cpus, so I think we need to avoid memory
leak caused by OOM.


Thanks,
Ming