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:   Mon, 25 Sep 2017 21:56:00 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Ingo Molnar <mingo@...nel.org>
cc:     linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Eric Biggers <ebiggers3@...il.com>,
        Andy Lutomirski <luto@...capital.net>,
        Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        "H . Peter Anvin" <hpa@...or.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Oleg Nesterov <oleg@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Rik van Riel <riel@...hat.com>,
        Yu-cheng Yu <yu-cheng.yu@...el.com>
Subject: Re: [PATCH 08/33] x86/fpu: Clarify parameter names in the
 copy_xstate_to_*() methods

On Sat, 23 Sep 2017, Ingo Molnar wrote:
>  static inline int
>  __copy_xstate_to_kernel(void *kbuf,
>  			const void *data,
> -			unsigned int pos, unsigned int count, int end_pos)
> +			unsigned int offset, unsigned int size, int size_total)

Why is size_total int?

>  {
> -	if (!count)
> +	if (!size)
>  		return 0;
>  
> -	if (end_pos < 0 || pos < end_pos) {
> -		unsigned int copy = end_pos < 0 ? count : min(count, end_pos - pos);
> +	if (size_total < 0 || offset < size_total) {

And why would it be < 0? The call sites of this inline are all inside of:

int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave,
    			unsigned int offset_start, int size_total)

and hand in size_total completely unmodified. copy_xstate_to_kernel()
itself has a single callsite:

int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
                unsigned int pos, unsigned int count,
                void *kbuf, void __user *ubuf)

and that hands in count unmodified.

The same issue is with the to_user() variant which is even more
obvious. All callers are inside of copy_xstate_to_user() where size_total
is an unsigned int argument which is handed in unmodified.

This signed/unsigned mismatch is confusing at best.

Thanks,

	tglx






Powered by blists - more mailing lists