forked from SELinuxProject/selinux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libselinux: Save digest of all partial matches for directory
We used to hash the file_context and skip the restorecon on the top level directory if the hash doesn't change. But the file_context might change after an OTA update; and some users experienced long restorecon time as they have lots of files under directories like /data/media. This CL tries to hash all the partial match entries in the file_context for each directory; and skips the restorecon if that digest stays the same, regardless of the changes to the other parts of file_context. This is a version ported from Android that was originally written by: xunchang <xunchang@google.com> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
- Loading branch information
Showing
12 changed files
with
560 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
libselinux/man/man3/selabel_get_digests_all_partial_matches.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.TH "selabel_get_digests_all_partial_matches" "3" "14 April 2019" "SELinux API documentation" | ||
|
||
.SH "NAME" | ||
selabel_get_digests_all_partial_matches \- retrieve the partial matches digest | ||
and the xattr digest that applies to the supplied path \- Only supported | ||
on file backend. | ||
. | ||
.SH "SYNOPSIS" | ||
.B #include <stdbool.h> | ||
.br | ||
.B #include <selinux/selinux.h> | ||
.br | ||
.B #include <selinux/label.h> | ||
.sp | ||
.BI "bool selabel_get_digests_all_partial_matches(" | ||
.in +\w'selabel_get_digests_all_partial_matches('u | ||
.BI "struct selabel_handle *" hnd , | ||
.br | ||
.BI "const char *" key , | ||
.br | ||
.BI "uint8_t **" calculated_digest , | ||
.br | ||
.BI "uint8_t **" xattr_digest , | ||
.br | ||
.BI "size_t *" digest_len ");" | ||
.in | ||
. | ||
.SH "DESCRIPTION" | ||
.BR selabel_get_digests_all_partial_matches () | ||
retrieves the file_contexts partial matches digest and the xattr digest that | ||
applies to the supplied path on the handle | ||
.IR hnd . | ||
.br | ||
The | ||
.IR key | ||
parameter is the path to retrieve the digests. | ||
.br | ||
The | ||
.IR calculated_digest | ||
is a pointer to the | ||
.IR key | ||
calculated file_contexts digest of all applicable partial matches, or NULL if | ||
none exist. The caller must | ||
.BR free (3) | ||
the buffer. | ||
.br | ||
The | ||
.IR xattr_digest | ||
is a pointer to the | ||
.IR key | ||
.BR xattr (7) | ||
stored digest, or NULL if it does not exist. | ||
The caller must | ||
.BR free (3) | ||
the buffer. | ||
.br | ||
The | ||
.IR digest_len | ||
is the length of the digests that will always be returned (even if both are | ||
NULL). Note that if both digests are returned, they will always be the same length. | ||
.sp | ||
.SH "RETURN VALUE" | ||
TRUE if the digests match or FALSE if they do not or either or both are missing. | ||
.sp | ||
.SH "SEE ALSO" | ||
.BR selinux_restorecon (3), | ||
.BR selabel_partial_match (3), | ||
.BR selabel_open (3), | ||
.BR selinux (8), | ||
.BR selabel_file (5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.