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>] [day] [month] [year] [list]
Date:	Mon, 14 Dec 2009 08:38:31 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	arjan@...radead.org, mingo@...hat.com, hpa@...or.com,
	Brice.Goglin@...ia.fr, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org, tglx@...utronix.de,
	kosaki.motohiro@...fujitsu.com
Cc:	kosaki.motohiro@...fujitsu.com, linux-tip-commits@...r.kernel.org,
	linux-kernel@...r.kernel.org, Brice.Goglin@...ia.fr, hpa@...or.com,
	mingo@...hat.com, arjan@...radead.org, akpm@...ux-foundation.org,
	tglx@...utronix.de
Subject: Re: [tip:x86/urgent] mm: Adjust do_pages_stat() so gcc can see copy_from_user() is safe

> Commit-ID:  b925585039cf39275c2e0e57512e5df27fa73aad
> Gitweb:     http://git.kernel.org/tip/b925585039cf39275c2e0e57512e5df27fa73aad
> Author:     H. Peter Anvin <hpa@...or.com>
> AuthorDate: Tue, 8 Dec 2009 14:01:32 -0800
> Committer:  H. Peter Anvin <hpa@...or.com>
> CommitDate: Fri, 11 Dec 2009 15:27:47 -0800
> 
> mm: Adjust do_pages_stat() so gcc can see copy_from_user() is safe
> 
> Slightly adjust the logic for determining the size of the
> copy_form_user() in do_pages_stat(); with this change, gcc can see
> that the copying is safe.
> 
> Without this, we get a build error for i386 allyesconfig:
> 
> /home/hpa/kernel/linux-2.6-tip.urgent/arch/x86/include/asm/uaccess_32.h:213:
> error: call to ‘copy_from_user_overflow’ declared with attribute
> error: copy_from_user() buffer size is not provably correct
> 
> Unlike an earlier patch from Arjan, this doesn't introduce new
> variables; merely reshuffles the compare so that gcc can see that an
> overflow cannot happen.
> 
> Signed-off-by: H. Peter Anvin <hpa@...or.com>
> Cc: Brice Goglin <Brice.Goglin@...ia.fr>
> Cc: Arjan van de Ven <arjan@...radead.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
> LKML-Reference: <20090926205406.30d55b08@...radead.org>
> ---
>  mm/migrate.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 7dbcb22..0bc640f 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1044,7 +1044,7 @@ static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
>  	int err;
>  
>  	for (i = 0; i < nr_pages; i += chunk_nr) {
> -		if (chunk_nr + i > nr_pages)
> +		if (chunk_nr > nr_pages - i)
>  			chunk_nr = nr_pages - i;

Ah, good. Thank you.
	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>





--
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