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] [day] [month] [year] [list]
Message-ID: <e9ddcfb1-b3d3-4ac7-a21a-b7543f449547@amd.com>
Date: Mon, 23 Sep 2024 16:03:47 +0530
From: Ravi Bangoria <ravi.bangoria@....com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>,
 Kan Liang <kan.liang@...ux.intel.com>, Mark Rutland <mark.rutland@....com>,
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
 Arnaldo Carvalho de Melo <acme@...nel.org>,
 LKML <linux-kernel@...r.kernel.org>, Stephane Eranian <eranian@...gle.com>,
 Ananth Narayan <ananth.narayan@....com>, Sandipan Das
 <sandipan.das@....com>, Ravi Bangoria <ravi.bangoria@....com>
Subject: Re: [PATCH 5/5] perf/x86: Relax privilege filter restriction on AMD
 IBS

Hi Namhyung,

> While IBS is available for per-thread profiling, still regular users
> cannot open an event due to the default paranoid setting (2) which
> doesn't allow unprivileged users to get kernel samples.  That means
> it needs to set exclude_kernel bit in the attribute but IBS driver
> would reject it since it has PERF_PMU_CAP_NO_EXCLUDE.  This is not what
> we want and I've been getting requests to fix this issue.

I'm working on some IBS improvements that impacts this change as well.
Is it be possible to hold off this patch for some time. I'll try to
post my patches soon.

> @@ -1111,6 +1127,12 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
>  		regs.flags |= PERF_EFLAGS_EXACT;
>  	}
>  
> +	if ((event->attr.config2 & IBS_SW_FILTER_MASK) &&
> +	    perf_exclude_event(event, &regs)) {
> +		throttle = perf_event_account_interrupt(event);
> +		goto out;
> +	}

Throttling can give surprises when the sample period is very small.
For ex,

  $ ./perf record -e cycles:uh -c 192 -- make
  [ perf record: Woken up 52 times to write data ]
  [ perf record: Captured and wrote 23.016 MB perf.data (705634 samples) ]

  $ ./perf record -e ibs_op/swfilt=1/uh -c 192 -- make
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 1.608 MB perf.data (19 samples) ]

It seems like the IBS event gets throttled (and disabled) before the
cpu get a chance to go back to userspace), hence we end up with very
few samples.

Thanks,
Ravi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ