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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140723143632.GV3935@laptop>
Date:	Wed, 23 Jul 2014 16:36:32 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Daniel Bristot de Oliveira <bristot@...hat.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...nel.org, tglx@...utronix.de,
	stable@...r.kernel.org, rostedt@...dmis.org
Subject: Re: [PATCH] sched: fix sched_setparam() policy=-1 logic

On Tue, Jul 22, 2014 at 11:27:41PM -0300, Daniel Bristot de Oliveira wrote:
> The scheduler uses policy=-1 to preserve the current policy state to
> implement sched_setparam(). But, as (int) -1 is equals to 0xffffffff,
> it's matching the if (policy & SCHED_RESET_ON_FORK) on
> _sched_setscheduler(). This match changes the policy value to an
> invalid value, breaking the sched_setparam() syscall.
> 
> This patch checks policy=-1 before check the SCHED_RESET_ON_FORK flag.
> 
> The following program shows the bug:
> 
> int main(void)
> {
> 	struct sched_param param = {
> 		.sched_priority = 5,
> 	};
> 
> 	sched_setscheduler(0, SCHED_FIFO, &param);
> 	param.sched_priority = 1;
> 	sched_setparam(0, &param);
> 	param.sched_priority = 0;
> 	sched_getparam(0, &param);
> 	if (param.sched_priority != 1)
> 		printf("failed priority setting (found %d instead of 1)\n",
> 			param.sched_priority);
> 	else
> 		printf("priority setting fine\n");
> }
> 
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: stable@...r.kernel.org # 3.14+
> Fixes: 7479f3c9cf67 "sched: Move SCHED_RESET_ON_FORK into attr::sched_flags"
> Reviewed-by: Steven Rostedt <rostedt@...dmis.org>
> Signed-off-by: Daniel Bristot de Oliveira <bristot@...hat.com>

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ