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: <20241029181008.GG14555@noisy.programming.kicks-ass.net>
Date: Tue, 29 Oct 2024 19:10:08 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	linux-kernel@...r.kernel.org, Indu Bhagat <indu.bhagat@...cle.com>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
	Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	linux-perf-users@...r.kernel.org, Mark Brown <broonie@...nel.org>,
	linux-toolchains@...r.kernel.org, Jordan Rome <jordalgo@...a.com>,
	Sam James <sam@...too.org>, linux-trace-kernel@...r.kerne.org,
	Andrii Nakryiko <andrii.nakryiko@...il.com>,
	Jens Remus <jremus@...ux.ibm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Florian Weimer <fweimer@...hat.com>,
	Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH v3 09/19] unwind: Introduce sframe user space unwinding

On Tue, Oct 29, 2024 at 09:50:18AM -0700, Josh Poimboeuf wrote:
> On Tue, Oct 29, 2024 at 02:27:09PM +0100, Peter Zijlstra wrote:
> > > +int sframe_add_section(unsigned long sframe_addr, unsigned long text_start,
> > > +		       unsigned long text_end)
> > > +{
> > > +	struct mm_struct *mm = current->mm;
> > > +	struct vm_area_struct *sframe_vma;
> > > +
> > > +	mmap_read_lock(mm);
> > 
> > DEFINE_GUARD(mmap_read_lock, struct mm_struct *,
> > 	     mmap_read_lock(_T), mmap_read_unlock(_T))
> > 
> > in include/linux/mmap_lock.h ?
> 
> Will do.
> 
> > > @@ -2784,6 +2785,16 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
> > >  	case PR_RISCV_SET_ICACHE_FLUSH_CTX:
> > >  		error = RISCV_SET_ICACHE_FLUSH_CTX(arg2, arg3);
> > >  		break;
> > > +	case PR_ADD_SFRAME:
> > > +		if (arg5)
> > > +			return -EINVAL;
> > > +		error = sframe_add_section(arg2, arg3, arg4);
> > > +		break;
> > > +	case PR_REMOVE_SFRAME:
> > > +		if (arg3 || arg4 || arg5)
> > > +			return -EINVAL;
> > > +		error = sframe_remove_section(arg2);
> > > +		break;
> > >  	default:
> > >  		error = -EINVAL;
> > >  		break;
> > 
> > So I realize that mtree has an internal lock, but are we sure we don't
> > want a lock around those prctl()s?
> 
> Not that I can tell?  It relies on the mtree internal locking for
> atomicity.
> 
> For sframe_remove_section() it uses srcu to delay the freeing until all
> sframe_find()'s have completed.

Yeah it does all that. But I was sorta looking at all that kmalloc and
copy from user stuff, but I suppose you can race that without problem.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ