Skip to contentSkip to conversation

Do we break POSIX?

DISCUSSION Tom 7 participants 7 messages Nov 10, 2003 – Nov 14, 2003 SELinux security module

lore
Share & tools
lore

Tom

author
#0 lore raw

One point brought up by Theo DeRaadt during PacSec was that according to POSIX, write operations can not return a permission denied error.

I could not argue with him on that because I have not actually read the POSIX standard, but he has a valid point in that breaking standards would be a big no.

Does anyone know immediately if this is so and if we are indeed breaking POSIX? If nobody can answer that, I will find out myself, as I've promised him to check.

Signature · 8 lines
PGP/GPG key: http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 10 lines · Tom

One point brought up by Theo DeRaadt during PacSec was that according to POSIX, write operations can not return a permission denied error.

I could not argue with him on that because I have not actually read the POSIX standard, but he has a valid point in that breaking standards would be a big no.

Does anyone know immediately if this is so and if we are indeed breaking POSIX? If nobody can answer that, I will find out myself, as I've promised him to check.

NFS can yield the same behavior. If you are holding a file open on the client and writing to it, and someone changes the ownership of the file on the server, then subsequent write() requests will fail with Permission denied. I just tested with a Linux client and server to verify, and this is what happens.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 5 lines

NFS can yield the same behavior. If you are holding a file open on the client and writing to it, and someone changes the ownership of the file on the server, then subsequent write() requests will fail with Permission denied. I just tested with a Linux client and server to verify, and this is what happens.

Find a Sun.
Test with Solaris.
(Just to be more sure.)

-- R;

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#4 lore raw
In reply to Tom

Hi!

write(2) on linux does not actually lists EACCESS as a possible error value. It also says: "Other errors may occur, depending on the object connected to fd."
Let's assume for now that returning permission denied error from write operation breaks POSIX.

I would not consider it a big issue, because
-write can do error return, and any well-behaved application should handle that, even when the error code is unexpected -if you want to be posixly correct, you can still give EIO as the error code
-revocation of permission to write occurs infrequently, as normally programs do not cross domains, and policy is reloaded only very infrequently. And you make your trusted procedures error resistant, don't you?

A levelezőm azt hiszi, hogy Tom a következőeket írta:

Quoted 22 lines

One point brought up by Theo DeRaadt during PacSec was that according to POSIX, write operations can not return a permission denied error.

I could not argue with him on that because I have not actually read the POSIX standard, but he has a valid point in that breaking standards would be a big no.

Does anyone know immediately if this is so and if we are indeed breaking POSIX? If nobody can answer that, I will find out myself, as I've promised him to check.

Signature · 8 lines
PGP/GPG key: http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Signature · 7 lines
GNU GPL: csak tiszta forrásból


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
In reply to Tom
Quoted 10 lines · Tom

One point brought up by Theo DeRaadt during PacSec was that according to POSIX, write operations can not return a permission denied error.

I could not argue with him on that because I have not actually read the POSIX standard, but he has a valid point in that breaking standards would be a big no.

Does anyone know immediately if this is so and if we are indeed breaking POSIX? If nobody can answer that, I will find out myself, as I've promised him to check.

The write( ) function may fail if:
[EACCES] A write was attempted on a socket and the calling
process does not have appropriate privileges.

POSIX says nothing about files, but for sockets, EACCES is a valid error code.

Thorsten

Signature · 9 lines
Thorsten Kukuk       http://www.suse.de/~kukuk/        [email protected]
SuSE Linux AG        Deutschherrnstr. 15-19        D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#6 lore raw
In reply to Tom
Quoted 10 lines · Tom

One point brought up by Theo DeRaadt during PacSec was that according to POSIX, write operations can not return a permission denied error.

I could not argue with him on that because I have not actually read the POSIX standard, but he has a valid point in that breaking standards would be a big no.

Does anyone know immediately if this is so and if we are indeed breaking POSIX? If nobody can answer that, I will find out myself, as I've promised him to check.

No, we do not break Posix, as anyone can add new error codes.

- James

Signature · 9 lines
James Morris
<[email protected]>



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
In reply to Stephen Smalley

On Mon, Nov 10, 2003 at 09:02:05AM -0500, Stephen Smalley wrote:
...

Quoted 10 lines
Quoted 4 lines

Does anyone know immediately if this is so and if we are indeed breaking POSIX? If nobody can answer that, I will find out myself, as I've promised him to check.

NFS can yield the same behavior. If you are holding a file open on the client and writing to it, and someone changes the ownership of the file on the server, then subsequent write() requests will fail with Permission denied. I just tested with a Linux client and server to verify, and this is what happens.

Yep.

But NFS doesn't claim to have POSIX semantics.

I doubt there are any real-world programs that would treat a write returning -1 with errno set to an 'unknown error', as a successful write.

(if such a program should exist, the author will be most thoroughly
dealt with when I take over ;)

So all in all I think that you are both correct, but the (my) conclusion is that it wouldn't matter if write returned EACCESS.

/ jakob

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.