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: <86c1b1fe-0dca-ce26-874e-aa83e3c77e6e@intel.com>
Date:   Mon, 13 Jun 2022 15:48:56 -0700
From:   Sohil Mehta <sohil.mehta@...el.com>
To:     <ira.weiny@...el.com>, <linux-api@...r.kernel.org>
CC:     Dave Hansen <dave.hansen@...ux.intel.com>,
        "Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
        <x86@...nel.org>, <linuxppc-dev@...ts.ozlabs.org>,
        <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
        <linux-kselftest@...r.kernel.org>
Subject: Re: [RFC PATCH 2/6] testing/pkeys: Don't use uninitialized variable

On 6/10/2022 4:35 PM, ira.weiny@...el.com wrote:
> diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
> index d0183c381859..43e47de19c0d 100644
> --- a/tools/testing/selftests/vm/protection_keys.c
> +++ b/tools/testing/selftests/vm/protection_keys.c
> @@ -1225,9 +1225,9 @@ void test_pkey_alloc_exhaust(int *ptr, u16 pkey)
>   		int new_pkey;
>   		dprintf1("%s() alloc loop: %d\n", __func__, i);
>   		new_pkey = alloc_pkey();
> -		dprintf4("%s()::%d, err: %d pkey_reg: 0x%016llx"
> +		dprintf4("%s()::%d, errno: %d pkey_reg: 0x%016llx"

What is errno referring to over here? There are a few things happening 
in alloc_pkey(). I guess it would show the latest error that happened. 
Does errno need to be set to 0 before the call?

Also, would it be useful to print the return value (new_pkey) from 
alloc_pkey() here?

>   				" shadow: 0x%016llx\n",
> -				__func__, __LINE__, err, __read_pkey_reg(),
> +				__func__, __LINE__, errno, __read_pkey_reg(),
>   				shadow_pkey_reg);
>   		read_pkey_reg(); /* for shadow checking */
>   		dprintf2("%s() errno: %d ENOSPC: %d\n", __func__, errno, ENOSPC);

Sohil

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ