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:   Thu, 22 Dec 2022 21:25:12 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Waiman Long <longman@...hat.com>
Cc:     Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Phil Auld <pauld@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH-tip v3] sched: Use kfree_rcu() in do_set_cpus_allowed()

On Thu, Dec 22, 2022 at 03:18:29PM -0500, Waiman Long wrote:

> > > @@ -8220,7 +8230,7 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
> > >   	struct affinity_context ac;
> > >   	struct cpumask *user_mask;
> > >   	struct task_struct *p;
> > > -	int retval;
> > > +	int retval, size;
> > >   	rcu_read_lock();
> > > @@ -8253,7 +8263,11 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
> > >   	if (retval)
> > >   		goto out_put_task;
> > > -	user_mask = kmalloc(cpumask_size(), GFP_KERNEL);
> > > +	/*
> > > +	 * See do_set_cpus_allowed() for the rcu_head usage.
> > > +	 */
> > > +	size = max_t(int, cpumask_size(), sizeof(struct rcu_head));
> > > +	user_mask = kmalloc(size, GFP_KERNEL);
> > >   	if (!user_mask) {
> > >   		retval = -ENOMEM;
> > >   		goto out_put_task;
> > AFAICT you forgot dup_user_cpus_ptr().
> 
> I haven't received any response from you for a while. So it is just a ping.

I was out sick :/

> Of course, I am aware that there is another dup_user_cpus_ptr() patch
> ouststanding. I will of course talk about that when you respond. I also have
> a pending rwsem patch series waiting for your review:-)

The point was that dup_user_cpus_ptr() also does an allocation and needs
to allocate the possibly bigger size too, no?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ