lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D09GVMLN1O4Z.2RXQUH4ZY5IVF@kernel.org>
Date: Tue, 02 Apr 2024 10:43:25 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Haitao Huang" <haitao.huang@...ux.intel.com>
Cc: <anakrish@...rosoft.com>, <bp@...en8.de>, <cgroups@...r.kernel.org>,
 <chrisyan@...rosoft.com>, <dave.hansen@...ux.intel.com>, <hpa@...or.com>,
 <kai.huang@...el.com>, <kristen@...ux.intel.com>,
 <linux-kernel@...r.kernel.org>, <linux-sgx@...r.kernel.org>,
 <mikko.ylinen@...ux.intel.com>, <mingo@...hat.com>, <mkoutny@...e.com>,
 <seanjc@...gle.com>, <sohil.mehta@...el.com>, <tglx@...utronix.de>,
 <tim.c.chen@...ux.intel.com>, <tj@...nel.org>, <x86@...nel.org>,
 <yangjie@...rosoft.com>, <zhanb@...rosoft.com>, <zhiquan1.li@...el.com>
Subject: Re: [PATCH v2] selftests/sgx: Improve cgroup test scripts

On Tue Apr 2, 2024 at 4:42 AM EEST, Haitao Huang wrote:
> Make cgroup test scripts ash compatible.
> Remove cg-tools dependency.
> Add documentation for functions.
>
> Tested with busybox on Ubuntu.
>
> Signed-off-by: Haitao Huang <haitao.huang@...ux.intel.com>
> ---
> v2:
> - Fixes for v2 cgroup
> - Turn off swapping before memcontrol tests and back on after
> - Add comments and reformat
> ---
>  tools/testing/selftests/sgx/ash_cgexec.sh     |  57 ++++++
>  .../selftests/sgx/run_epc_cg_selftests.sh     | 187 +++++++++++-------
>  .../selftests/sgx/watch_misc_for_tests.sh     |  13 +-
>  3 files changed, 179 insertions(+), 78 deletions(-)
>  create mode 100755 tools/testing/selftests/sgx/ash_cgexec.sh
>
> diff --git a/tools/testing/selftests/sgx/ash_cgexec.sh b/tools/testing/selftests/sgx/ash_cgexec.sh
> new file mode 100755
> index 000000000000..9607784378df
> --- /dev/null
> +++ b/tools/testing/selftests/sgx/ash_cgexec.sh
> @@ -0,0 +1,57 @@
> +#!/usr/bin/env sh
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright(c) 2024 Intel Corporation.
> +
> +# Move the current shell process to the specified cgroup
> +# Arguments:
> +# 	$1 - The cgroup controller name, e.g., misc, memory.
> +#	$2 - The path of the cgroup,
> +#		relative to /sys/fs/cgroup for cgroup v2,
> +#		relative to /sys/fs/cgroup/$1 for v1.
> +move_to_cgroup() {
> +    controllers="$1"
> +    path="$2"
> +
> +    # Check if cgroup v2 is in use
> +    if [ ! -d "/sys/fs/cgroup/misc" ]; then
> +        # Cgroup v2 logic
> +        cgroup_full_path="/sys/fs/cgroup/${path}"
> +        echo $$ > "${cgroup_full_path}/cgroup.procs"
> +    else
> +        # Cgroup v1 logic
> +        OLD_IFS="$IFS"
> +        IFS=','
> +        for controller in $controllers; do
> +            cgroup_full_path="/sys/fs/cgroup/${controller}/${path}"
> +            echo $$ > "${cgroup_full_path}/tasks"
> +        done
> +        IFS="$OLD_IFS"
> +    fi

I think that if you could point me to git v10 and all this I could
then quite easily create test image and see what I get from that.

I will code review the whole thing but this is definitely good
enough to start testing this series properly! Thanks for the
effort with this. The payback from this comes after the feature
is mainline. We have now sort of reference of the usage patterns
and less layers when we need to debug any possible (likely) bugs
in the future.

This is definitely to the right direction. I'm just wondering do
we want to support v1 cgroups or would it make sense support only
v2?
 
BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ