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] [day] [month] [year] [list]
Date:	Tue, 5 Feb 2013 21:19:03 +0100
From:	Jens Axboe <axboe@...nel.dk>
To:	majianpeng <majianpeng@...il.com>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: Re: For the condition "file->f_mode", when it failed, it should
 return EACCES rather than EBADF.

On Tue, Feb 05 2013, majianpeng wrote:
> >On Sun, Feb 03 2013, majianpeng wrote:
> >> Hi all,
> >> 	When I wanted to do discard operations,but i set the  openflag was O_RDONLY,it returned a EBADF rather than EACCES or EPERM.
> >> I searched the code and found:
> >> >case BLKDISCARD:
> >> >case BLKSECDISCARD: {
> >> >		uint64_t range[2];
> >> 
> >> >		if (!(mode & FMODE_WRITE))
> >> >			return -EBADF;
> >> Initial i thought there was error.But i searched all code of kernel and found some places like this.
> >> 
> >> The description of EBADF is "Bad file numbe". There are some places where returned EBADF like,
> >> >if (!f.file)
> >> >		return -EBADF;
> >> 
> >> So i think for checking file->f_mode when failed, it should return EACCESS.
> >
> >But that would break the ABI at this point. I agree with you, though,
> >EBADF is not the right error for this case.
> >
> >-- 
> >Jens Axboe
> >
> Sorry, can you explain in detail? Why can it break the ABI ?

Applications already depending on EBADF being returned for attempt to
discard on a file descriptor not opened for write. Granted it's a slim
possiblity, but it exists.

-- 
Jens Axboe

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