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]
Date:   Wed, 28 Aug 2019 01:12:44 +0100
From:   Ben Hutchings <ben@...adent.org.uk>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Cc:     stable@...r.kernel.org, Thomas Richter <tmricht@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        Heiko Carstens <heiko.carstens@...ibm.com>,
        Hendrik Brueckner <brueckner@...ux.vnet.ibm.com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.9 033/223] perf test 6: Fix missing kvm module load
 for s390

On Fri, 2019-08-02 at 11:34 +0200, Greg Kroah-Hartman wrote:
> [ Upstream commit 53fe307dfd309e425b171f6272d64296a54f4dff ]

This results in numerous compiler errors:

tests/parse-events.c: In function 'kvm_s390_create_vm_valid':
tests/parse-events.c:25:14: error: implicit declaration of function 'get_events_file' [-Werror=implicit-function-declaration]
  eventfile = get_events_file("kvm-s390");
              ^~~~~~~~~~~~~~~
tests/parse-events.c:25:12: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
  eventfile = get_events_file("kvm-s390");
            ^
tests/parse-events.c:34:3: error: implicit declaration of function 'put_events_file' [-Werror=implicit-function-declaration]
   put_events_file(eventfile);
   ^~~~~~~~~~~~~~~
tests/parse-events.c: At top level:
tests/parse-events.c:1622:3: error: unknown field 'valid' specified in initializer
   .valid = kvm_s390_create_vm_valid,
   ^
tests/parse-events.c:1622:12: error: excess elements in struct initializer [-Werror]
   .valid = kvm_s390_create_vm_valid,
            ^~~~~~~~~~~~~~~~~~~~~~~~
tests/parse-events.c:1622:12: note: (near initialization for 'test__events[45]')

It is using functions that were only added in Linux 4.18 so I think it
should be reverted from the 4.4, 4.9, and 4.14 stable branches.

Ben.

> Command
> 
>    # perf test -Fv 6
> 
> fails with error
> 
>    running test 100 'kvm-s390:kvm_s390_create_vm' failed to parse
>     event 'kvm-s390:kvm_s390_create_vm', err -1, str 'unknown tracepoint'
>     event syntax error: 'kvm-s390:kvm_s390_create_vm'
>                          \___ unknown tracepoint
> 
> when the kvm module is not loaded or not built in.
> 
> Fix this by adding a valid function which tests if the module
> is loaded. Loaded modules (or builtin KVM support) have a
> directory named
>   /sys/kernel/debug/tracing/events/kvm-s390
> for this tracepoint.
> 
> Check for existence of this directory.
> 
> Signed-off-by: Thomas Richter <tmricht@...ux.ibm.com>
> Reviewed-by: Christian Borntraeger <borntraeger@...ibm.com>
> Cc: Heiko Carstens <heiko.carstens@...ibm.com>
> Cc: Hendrik Brueckner <brueckner@...ux.vnet.ibm.com>
> Link: http://lkml.kernel.org/r/20190604053504.43073-1-tmricht@linux.ibm.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
>  tools/perf/tests/parse-events.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
> index aa9276bfe3e9..9134a0c3e99d 100644
> --- a/tools/perf/tests/parse-events.c
> +++ b/tools/perf/tests/parse-events.c
> @@ -12,6 +12,32 @@
>  #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
>  			     PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
>  
> +#if defined(__s390x__)
> +/* Return true if kvm module is available and loaded. Test this
> + * and retun success when trace point kvm_s390_create_vm
> + * exists. Otherwise this test always fails.
> + */
> +static bool kvm_s390_create_vm_valid(void)
> +{
> +	char *eventfile;
> +	bool rc = false;
> +
> +	eventfile = get_events_file("kvm-s390");
> +
> +	if (eventfile) {
> +		DIR *mydir = opendir(eventfile);
> +
> +		if (mydir) {
> +			rc = true;
> +			closedir(mydir);
> +		}
> +		put_events_file(eventfile);
> +	}
> +
> +	return rc;
> +}
> +#endif
> +
>  static int test__checkevent_tracepoint(struct perf_evlist *evlist)
>  {
>  	struct perf_evsel *evsel = perf_evlist__first(evlist);
> @@ -1593,6 +1619,7 @@ static struct evlist_test test__events[] = {
>  	{
>  		.name  = "kvm-s390:kvm_s390_create_vm",
>  		.check = test__checkevent_tracepoint,
> +		.valid = kvm_s390_create_vm_valid,
>  		.id    = 100,
>  	},
>  #endif
-- 
Ben Hutchings
If the facts do not conform to your theory, they must be disposed of.


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ