libselinux: save errno value in avc_has_perm()
PATCH 1/1 libselinux: save errno value in avc_has_perm()
The errno value set by avc_has_perm_noaudit() is being lost somewhere in the bowels of avc_audit(). This patch saves it off so it doesn't get lost.
Signed-off-by Eamon Walsh <[email protected]>
---
libselinux/src/avc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
src/avc.c +0 -0
@@ -874,10 +874,12 @@
struct avc_entry_ref *aeref, void *auditdata)
{
struct av_decision avd = { 0, 0, 0, 0, 0 };- int rc;
+ int errsave, rc;
rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, aeref, &avd); + errsave = errno; avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata); + errno = errsave; return rc; }
Signature · 8 lines
Eamon Walsh <[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.
Quoted 4 lines · Eamon Walsh
The errno value set by
avc_has_perm_noaudit()is being lost somewhere in the bowels ofavc_audit(). This patch saves it off so it doesn't get lost.Signed-off-by Eamon Walsh <[email protected]>
Acked-by Stephen Smalley <[email protected]>
Merge at will.
Seems suitable for the stable branch too.
Quoted 25 lines
---
libselinux/src/avc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Index:
libselinux/src/avc.c
===================================================================src/avc.c +3
-1@@ -874,10 +874,12 @@ struct avc_entry_ref *aeref, void *auditdata) { struct av_decision avd = { 0, 0, 0, 0, 0 }; -int rc; +int errsave, rc; rc =avc_has_perm_noaudit (ssid, tsid, tclass, requested, aeref, &avd); + errsave = errno;avc_audit (ssid, tsid, tclass, requested, &avd, rc, auditdata); + errno = errsave;return rc; }
Signature · 8 lines
Stephen Smalley 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.