Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752044AbZL1PKI (ORCPT ); Mon, 28 Dec 2009 10:10:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751714AbZL1PKH (ORCPT ); Mon, 28 Dec 2009 10:10:07 -0500 Received: from casper.infradead.org ([85.118.1.10]:37926 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751297AbZL1PKG (ORCPT ); Mon, 28 Dec 2009 10:10:06 -0500 Subject: Re: [RFC 12/12][PATCH] SCHED_DEADLINE: modified sched_*_ex API From: Peter Zijlstra To: Raistlin Cc: linux-kernel , michael trimarchi , Fabio Checconi , Ingo Molnar , Thomas Gleixner , Dhaval Giani , Johan Eker , "p.faure" , Chris Friesen , Steven Rostedt , Henrik Austad , Frederic Weisbecker , Darren Hart , Sven-Thorsten Dietrich , Bjoern Brandenburg , Tommaso Cucinotta , "giuseppe.lipari" , Juri Lelli In-Reply-To: <1255708086.6228.469.camel@Palantir> References: <1255707324.6228.448.camel@Palantir> <1255708086.6228.469.camel@Palantir> Content-Type: text/plain; charset="UTF-8" Date: Mon, 28 Dec 2009 16:09:18 +0100 Message-ID: <1262012958.7135.124.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1560 Lines: 43 On Fri, 2009-10-16 at 17:48 +0200, Raistlin wrote: > @@ -6807,9 +6811,10 @@ out_unlock: > /** > * sys_sched_getparam - get the DEADLINE task parameters of a thread > * @pid: the pid in question. > + * @len: size of data pointed by param_ex. > * @param_ex: structure containing the new parameters (deadline, runtime, etc.). > */ > -SYSCALL_DEFINE2(sched_getparam_ex, pid_t, pid, > +SYSCALL_DEFINE3(sched_getparam_ex, pid_t, pid, unsigned, len, > struct sched_param_ex __user *, param_ex) > { > struct sched_param_ex lp; > @@ -6818,6 +6823,8 @@ SYSCALL_DEFINE2(sched_getparam_ex, pid_t, pid, > > if (!param_ex || pid < 0) > return -EINVAL; > + if (len < sizeof(struct sched_param_ex)) > + return -EINVAL; > > read_lock(&tasklist_lock); > p = find_process_by_pid(pid); This allows len > sizeof(). > @@ -6837,7 +6844,7 @@ SYSCALL_DEFINE2(sched_getparam_ex, pid_t, pid, > /* > * This one might sleep, we cannot do it with a spinlock held ... > */ > - retval = copy_to_user(param_ex, &lp, sizeof(*param_ex)) ? -EFAULT : 0; > + retval = copy_to_user(param_ex, &lp, len) ? -EFAULT : 0; > > return retval; Which would copy more than lp, resulting in a stack leak, right? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/