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]
Message-ID: <CALCETrXCo3doNCoxLPr5p+SPc1CnnFmFcPWKk0m7M1_WOGJWYw@mail.gmail.com>
Date:	Thu, 9 Jun 2016 10:08:51 -0700
From:	Andy Lutomirski <luto@...capital.net>
To:	"Zhangjian (Bamvor)" <bamvor.zhangjian@...wei.com>
Cc:	Weidong Wang <wangweidong1@...wei.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Arnd Bergmann <arnd@...db.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	X86 ML <x86@...nel.org>, Hanjun Guo <guohanjun@...wei.com>,
	Linux-Api <linux-api@...r.kernel.org>
Subject: Re: [RFC PATCH] sys_read: add a compat_sys_read for 64bit system

On Tue, Jun 7, 2016 at 7:14 PM, Zhangjian (Bamvor)
<bamvor.zhangjian@...wei.com> wrote:
> Hi,
>
> On 2016/6/8 9:33, Weidong Wang wrote:
>>
>> Test 32 progress and 64 progress on the 64bit system with
>> this progress:
>>
>> int main(int argc, char **argv)
>> {
>>          int fd = 0;
>>          int i, ret = 0;
>>          char buf[512];
>>          unsigned long count = -1;
>>
>>          fd = open("/tmp", O_RDONLY);
>>          if (fd < -1) {
>>                  printf("Pls check the directory is exist?\n");
>>                  return -1;
>>          }
>>          errno = 0;
>>          ret = read(fd, NULL, count);
>>          printf("Ret is %d errno %d\n", ret, errno);
>>          close(fd);
>>
>>          return 0;
>> }
>>
>> we get the different errno. The 64 progress we get errno is -14 while
>> the 32 progress is -21.

On 64-bit, you get -14 == -EFAULT.  Seems reasonable: you passed a bad pointer.

On 32-bit, you get -21 == -EISDIR.  Also seems reasonable: fd is a directory.

>>
>> The reason is that, the user progress would use a 32bit count, while
>> the sys_read size_t in kernel is 64bit.  When the uesrspace count is
>> -1(0xffffffff), it goes to the sys_read, it would be change to a positive
>> number.

That parameter is size_t, which is unsigned.  It's a positive number
in both cases.

I don't think there's a bug here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ