All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Gyurdiev <ivg2@cornell.edu>
To: selinux@tycho.nsa.gov
Cc: Joshua Brindle <jbrindle@tresys.com>,
	Stephen Smalley <sds@tycho.nsa.gov>
Subject: [ SEMANAGE ] Acquire/release read lock in databases
Date: Mon, 17 Oct 2005 18:17:10 -0400	[thread overview]
Message-ID: <435422E6.8090807@cornell.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 347 bytes --]

The read lock needs to be fixed, which is why this code was commented 
out in the first place. However, I think Joshua will submit a patch for 
that, so..uncomment this code to provide locking for database read-only 
functions. The locking is supposed to provide safety against 
simultaneous commit. It also serializes readers as a side effect.



[-- Attachment #2: libsemanage.read_lock.diff --]
[-- Type: text/x-patch, Size: 1967 bytes --]

diff -Naurp --exclude CVS --exclude ChangeLog --exclude VERSION --exclude 'semanage_store*' --exclude 'module_record*' --exclude 'database_directory*' old/libsemanage/src/database_direct.c new/libsemanage/src/database_direct.c
--- old/libsemanage/src/database_direct.c	2005-10-13 13:08:35.000000000 -0400
+++ new/libsemanage/src/database_direct.c	2005-10-17 18:12:06.000000000 -0400
@@ -160,10 +160,10 @@ static int enter_ro(
 		return STATUS_ERR;
 	}
 	
-	//if (semanage_handle_get_read_lock(handle) < 0) {
-	//	/* FIXME: handle error */
-	//	return STATUS_ERR;
-	//}
+	if (semanage_get_read_lock(handle) < 0) {
+		/* FIXME: handle error */
+		return STATUS_ERR;
+	}
 
 	if (dbase_direct_cache(handle, dbase) < 0) {
 		/* FIXME: handle error */
@@ -177,7 +177,7 @@ static inline void exit_ro(
 	semanage_handle_t* handle,
 	dbase_direct_t* dbase) {
 
-	//semanage_release_read_lock(handle);
+	semanage_release_read_lock(handle);
 	dbase_direct_drop_cache(handle, dbase);
 }
 
diff -Naurp --exclude CVS --exclude ChangeLog --exclude VERSION --exclude 'semanage_store*' --exclude 'module_record*' --exclude 'database_directory*' old/libsemanage/src/database_file.c new/libsemanage/src/database_file.c
--- old/libsemanage/src/database_file.c	2005-10-13 13:08:35.000000000 -0400
+++ new/libsemanage/src/database_file.c	2005-10-17 18:12:31.000000000 -0400
@@ -218,10 +218,10 @@ static int enter_ro(
 	semanage_handle_t* handle,
 	dbase_file_t* dbase) {
 
-	//if (semanage_handle_get_read_lock(handle) < 0) {
-	//	/* FIXME: handle error */
-	//	return STATUS_ERR;
-	//}
+	if (semanage_get_read_lock(handle) < 0) {
+		/* FIXME: handle error */
+		return STATUS_ERR;
+	}
 
 	if (dbase_file_cache(handle, dbase) < 0) {
 		/* FIXME: handle error */
@@ -235,7 +235,7 @@ static inline void exit_ro(
 	semanage_handle_t* handle,
 	dbase_file_t* dbase) {
 
-	//semanage_release_read_lock(handle);
+	semanage_release_read_lock(handle);
 	dbase_file_drop_cache(handle, dbase);
 }
 

                 reply	other threads:[~2005-10-17 22:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=435422E6.8090807@cornell.edu \
    --to=ivg2@cornell.edu \
    --cc=jbrindle@tresys.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.