All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] include/tst_cgroup.h: Replace hardcoded cgroup paths
@ 2020-12-30 15:48 Bogdan Lezhepekov
  2020-12-31  3:01 ` Li Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Bogdan Lezhepekov @ 2020-12-30 15:48 UTC (permalink / raw)
  To: ltp

Macros PATH_TMP_CG_CST and PATH_TMP_CG_MEM defined cgroup
temporary directory paths to be in /tmp that can be a mount point.

Enable an option to set PATH_TMP_CG_CST and PATH_TMP_CG_MEM
through TMPDIR environment variable keeping old paths as default ones.

Signed-off-by: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com>
---
 include/tst_cgroup.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
index bfd848260..0f7db5487 100644
--- a/include/tst_cgroup.h
+++ b/include/tst_cgroup.h
@@ -7,8 +7,9 @@
 #ifndef TST_CGROUP_H
 #define TST_CGROUP_H
 
-#define PATH_TMP_CG_MEM	"/tmp/cgroup_mem"
-#define PATH_TMP_CG_CST	"/tmp/cgroup_cst"
+#define PATH_BASE (getenv("TMPDIR") ? getenv("TMPDIR") : "/tmp")
+#define PATH_TMP_CG_CST (strcat(PATH_BASE, "/cgroup_cst"))
+#define PATH_TMP_CG_MEM (strcat(PATH_BASE, "/cgroup_mem"))
 
 enum tst_cgroup_ver {
 	TST_CGROUP_V1 = 1,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH v1] include/tst_cgroup.h: Replace hardcoded cgroup paths
  2020-12-30 15:48 [LTP] [PATCH v1] include/tst_cgroup.h: Replace hardcoded cgroup paths Bogdan Lezhepekov
@ 2020-12-31  3:01 ` Li Wang
  2020-12-31 10:38   ` Bogdan Lezhepekov
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2020-12-31  3:01 UTC (permalink / raw)
  To: ltp

Hi Bogdan,

On Wed, Dec 30, 2020 at 11:49 PM Bogdan Lezhepekov via ltp <
ltp@lists.linux.it> wrote:

> Macros PATH_TMP_CG_CST and PATH_TMP_CG_MEM defined cgroup
> temporary directory paths to be in /tmp that can be a mount point.
>
> Enable an option to set PATH_TMP_CG_CST and PATH_TMP_CG_MEM
> through TMPDIR environment variable keeping old paths as default ones.
>
> Signed-off-by: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com>
> ---
>  include/tst_cgroup.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
> index bfd848260..0f7db5487 100644
> --- a/include/tst_cgroup.h
> +++ b/include/tst_cgroup.h
> @@ -7,8 +7,9 @@
>  #ifndef TST_CGROUP_H
>  #define TST_CGROUP_H
>
> -#define PATH_TMP_CG_MEM        "/tmp/cgroup_mem"
> -#define PATH_TMP_CG_CST        "/tmp/cgroup_cst"
> +#define PATH_BASE (getenv("TMPDIR") ? getenv("TMPDIR") : "/tmp")
> +#define PATH_TMP_CG_CST (strcat(PATH_BASE, "/cgroup_cst"))
> +#define PATH_TMP_CG_MEM (strcat(PATH_BASE, "/cgroup_mem"))
>

As described on strcat() manual page, the potential risk is that buffer
overruns might cause an unpredictable problem.

I won't like to merge this patch because, Richard raised a new method to
refactor the whole CGroup API. And the patchset is pending on reviewing.

http://lists.linux.it/pipermail/ltp/2020-December/020274.html

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20201231/19f96021/attachment.htm>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH v1] include/tst_cgroup.h: Replace hardcoded cgroup paths
  2020-12-31  3:01 ` Li Wang
@ 2020-12-31 10:38   ` Bogdan Lezhepekov
  0 siblings, 0 replies; 3+ messages in thread
From: Bogdan Lezhepekov @ 2020-12-31 10:38 UTC (permalink / raw)
  To: ltp

Hi Li,

Thanks for the review and pointing to the Richard's update, haven't seen that before.
Regards,
Bogdan

On Dec 31 2020, at 6:01 am, Li Wang <liwang@redhat.com> wrote:
> Hi Bogdan,
>
>
> On Wed, Dec 30, 2020 at 11:49 PM Bogdan Lezhepekov via ltp <ltp@lists.linux.it (mailto:ltp@lists.linux.it)> wrote:
> > Macros PATH_TMP_CG_CST and PATH_TMP_CG_MEM defined cgroup
> > temporary directory paths to be in /tmp that can be a mount point.
> >
> > Enable an option to set PATH_TMP_CG_CST and PATH_TMP_CG_MEM
> > through TMPDIR environment variable keeping old paths as default ones.
> >
> > Signed-off-by: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com (mailto:bogdan.lezhepekov@suse.com)>
> > ---
> > include/tst_cgroup.h | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
> > index bfd848260..0f7db5487 100644
> > --- a/include/tst_cgroup.h
> > +++ b/include/tst_cgroup.h
> > @@ -7,8 +7,9 @@
> > #ifndef TST_CGROUP_H
> > #define TST_CGROUP_H
> >
> > -#define PATH_TMP_CG_MEM "/tmp/cgroup_mem"
> > -#define PATH_TMP_CG_CST "/tmp/cgroup_cst"
> > +#define PATH_BASE (getenv("TMPDIR") ? getenv("TMPDIR") : "/tmp")
> > +#define PATH_TMP_CG_CST (strcat(PATH_BASE, "/cgroup_cst"))
> > +#define PATH_TMP_CG_MEM (strcat(PATH_BASE, "/cgroup_mem"))
>
>
> As described on strcat() manual page, the potential risk is that buffer overruns might cause an unpredictable problem.
>
> I won't like to merge this patch because, Richard raised a new method to refactor the whole CGroup API. And the patchset is pending on reviewing.
>
> http://lists.linux.it/pipermail/ltp/2020-December/020274.html
>
> --
> Regards,
>
> Li Wang
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20201231/3a4f3ac0/attachment.htm>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-31 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 15:48 [LTP] [PATCH v1] include/tst_cgroup.h: Replace hardcoded cgroup paths Bogdan Lezhepekov
2020-12-31  3:01 ` Li Wang
2020-12-31 10:38   ` Bogdan Lezhepekov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.