On Thu, Dec 22, 2022 at 03:18:29PM -0500, Waiman Long wrote:
I was out sick :/I haven't received any response from you for a while. So it is just a ping.@@ -8220,7 +8230,7 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)AFAICT you forgot dup_user_cpus_ptr().
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;
Of course, I am aware that there is another dup_user_cpus_ptr() patchThe point was that dup_user_cpus_ptr() also does an allocation and needs
ouststanding. I will of course talk about that when you respond. I also have
a pending rwsem patch series waiting for your review:-)
to allocate the possibly bigger size too, no?