[lxc-devel] [PATCH lxcfs 1/5] fix missing dereferencing in must_strcat_pid

2016-01-07 Thread Wolfgang Bumiller
Fixes a segfault when reading a /tasks file of a cgroup containing a large number of pids. Signed-off-by: Wolfgang Bumiller --- lxcfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lxcfs.c b/lxcfs.c index fe5ac3e..767a344 100644 --- a/lxcfs.c +++ b/lxcfs.c @@ -85,7 +85,7 @

[lxc-devel] [PATCH lxcfs 4/5] cgfs: fix dorealloc's batch allocation

2016-01-07 Thread Wolfgang Bumiller
The initial check should use real lengths as with modulo a new required length of eg. 52 would be considered smaller than an old length of 48 (2 < 48). To get the 'batches' count 'newlen' must be divided and not taken modulo BATCH_SIZE. Otherwise '101', which would need a 3rd batch to reach 150, w

[lxc-devel] [PATCH lxcfs 2/5] avoid strlen in must_strcat_pid

2016-01-07 Thread Wolfgang Bumiller
sprintf() already returns the length Signed-off-by: Wolfgang Bumiller --- lxcfs.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lxcfs.c b/lxcfs.c index 767a344..8605000 100644 --- a/lxcfs.c +++ b/lxcfs.c @@ -77,7 +77,7 @@ static void must_strcat_pid(char **src, size

[lxc-devel] [PATCH lxcfs 3/5] fix leak in realloc loop in must_strcat_pid

2016-01-07 Thread Wolfgang Bumiller
If the first realloc() call fails then 'd' becomes NULL, subsequent realloc() retries will behave like malloc() and the the original src pointer is never freed. Further more the newly allocated data then contains uninitialized data where the previous pids had been stored. Avoid this by passing the

Re: [lxc-devel] [PATCH lxcfs 4/5] cgfs: fix dorealloc's batch allocation

2016-01-07 Thread Serge Hallyn
Quoting Wolfgang Bumiller (w.bumil...@proxmox.com): > The initial check should use real lengths as with modulo a > new required length of eg. 52 would be considered smaller > than an old length of 48 (2 < 48). > > To get the 'batches' count 'newlen' must be divided and not > taken modulo BATCH_SIZ

Re: [lxc-devel] [PATCH lxcfs 4/5] cgfs: fix dorealloc's batch allocation

2016-01-07 Thread Serge Hallyn
Quoting Wolfgang Bumiller (w.bumil...@proxmox.com): > > > On January 7, 2016 at 7:42 PM Serge Hallyn wrote: > > > > > > Quoting Wolfgang Bumiller (w.bumil...@proxmox.com): > > > The initial check should use real lengths as with modulo a > > > new required length of eg. 52 would be considered sm

Re: [lxc-devel] [PATCH lxcfs 3/5] fix leak in realloc loop in must_strcat_pid

2016-01-07 Thread Serge Hallyn
Quoting Wolfgang Bumiller (w.bumil...@proxmox.com): > If the first realloc() call fails then 'd' becomes NULL, > subsequent realloc() retries will behave like malloc() and > the the original src pointer is never freed. Further more > the newly allocated data then contains uninitialized data > where