Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-22 Thread Dmitry Vyukov
On Sun, Jan 21, 2018 at 6:54 PM, Shankara Pailoor wrote: > Below is a reproducer. > > #define _GNU_SOURCE > #include > #include > #include > #include > #include > > #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) > #define KCOV_ENABLE _IO('c', 100) > #define

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-22 Thread Dmitry Vyukov
On Sun, Jan 21, 2018 at 6:54 PM, Shankara Pailoor wrote: > Below is a reproducer. > > #define _GNU_SOURCE > #include > #include > #include > #include > #include > > #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) > #define KCOV_ENABLE _IO('c', 100) > #define KCOV_DISABLE _IO('c', 101) >

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-21 Thread Shankara Pailoor
Below is a reproducer. #define _GNU_SOURCE #include #include #include #include #include #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) #define KCOV_ENABLE _IO('c', 100) #define KCOV_DISABLE _IO('c', 101) #define COVER_SIZE (16 << 20) void kcov_setup() { unsigned long *cover;

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-21 Thread Shankara Pailoor
Below is a reproducer. #define _GNU_SOURCE #include #include #include #include #include #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) #define KCOV_ENABLE _IO('c', 100) #define KCOV_DISABLE _IO('c', 101) #define COVER_SIZE (16 << 20) void kcov_setup() { unsigned long *cover;

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-21 Thread Shankara Pailoor
Hi Dmitry, The leaks went away when I disabled and closed the old file descriptors before opening new ones. The patch you sent wouldn't work because t is not initialized at the line. This seems to work for me diff --git a/kernel/kcov.c b/kernel/kcov.c index 7594c03..1397006 100644 ---

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-21 Thread Shankara Pailoor
Hi Dmitry, The leaks went away when I disabled and closed the old file descriptors before opening new ones. The patch you sent wouldn't work because t is not initialized at the line. This seems to work for me diff --git a/kernel/kcov.c b/kernel/kcov.c index 7594c03..1397006 100644 ---

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-20 Thread Dmitry Vyukov
On Sat, Jan 20, 2018 at 4:01 PM, Shankara Pailoor wrote: > Hi Dmitry, > > I will try and get something to you tomorrow. Just wondering, but what > happens to the old struct kcov if a task opens /sys/kernel/debug/kcov > twice? I am looking here >

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-20 Thread Dmitry Vyukov
On Sat, Jan 20, 2018 at 4:01 PM, Shankara Pailoor wrote: > Hi Dmitry, > > I will try and get something to you tomorrow. Just wondering, but what > happens to the old struct kcov if a task opens /sys/kernel/debug/kcov > twice? I am looking here >

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-20 Thread Shankara Pailoor
Hi Dmitry, I will try and get something to you tomorrow. Just wondering, but what happens to the old struct kcov if a task opens /sys/kernel/debug/kcov twice? I am looking here https://elixir.free-electrons.com/linux/v4.15-rc8/source/kernel/kcov.c#L381 and I don't see where the previous struct

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-20 Thread Shankara Pailoor
Hi Dmitry, I will try and get something to you tomorrow. Just wondering, but what happens to the old struct kcov if a task opens /sys/kernel/debug/kcov twice? I am looking here https://elixir.free-electrons.com/linux/v4.15-rc8/source/kernel/kcov.c#L381 and I don't see where the previous struct

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-20 Thread Dmitry Vyukov
On Fri, Jan 19, 2018 at 8:29 PM, Shankara Pailoor wrote: > Hi Dmitry, > > I added support for kcov in strace and I have been tracing a fairly > large program but after a little while, I notice that when I mmap a > new cover buffer, the call fails with ENOMEM. After killing

Re: Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-20 Thread Dmitry Vyukov
On Fri, Jan 19, 2018 at 8:29 PM, Shankara Pailoor wrote: > Hi Dmitry, > > I added support for kcov in strace and I have been tracing a fairly > large program but after a little while, I notice that when I mmap a > new cover buffer, the call fails with ENOMEM. After killing the > program, I try

Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-19 Thread Shankara Pailoor
Hi Dmitry, I added support for kcov in strace and I have been tracing a fairly large program but after a little while, I notice that when I mmap a new cover buffer, the call fails with ENOMEM. After killing the program, I try and rerun and I notice that there is nearly no memory on the system.

Possible Memory Leak in KCOV Linux 4.15-rc1

2018-01-19 Thread Shankara Pailoor
Hi Dmitry, I added support for kcov in strace and I have been tracing a fairly large program but after a little while, I notice that when I mmap a new cover buffer, the call fails with ENOMEM. After killing the program, I try and rerun and I notice that there is nearly no memory on the system.