Re: [PATCH v3 09/19] unwind: Introduce sframe user space unwinding

Josh Poimboeuf <[email protected]>
Newsgroups org.kernel.vger.linux-toolchains,org.kernel.vger.linux-kernel,org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
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.

-- 
Josh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.