Tomasz Swierczek [Fri, 13 Jun 2025 08:11:54 +0000 (10:11 +0200)]
Release 2.0.10
* Add missing include for getpid()
Change-Id: Icbc57e650ee8e55d2420dd25973cd1fa0d210ec2
Tomasz Swierczek [Fri, 13 Jun 2025 08:10:49 +0000 (10:10 +0200)]
Add missing include for getpid()
Change-Id: Ie6ddbe2451a71d0b9dd6679a9ff32c46e67f26cc
Krzysztof Jackiewicz [Mon, 9 Jun 2025 15:56:54 +0000 (17:56 +0200)]
Release 2.0.9
* Implement thread watchdog
* Fix deadlock with license-manager
Change-Id: I0712f9f8aae636d1198237745a4fa8bcfcd69123
Krzysztof Jackiewicz [Wed, 11 Jun 2025 09:46:58 +0000 (11:46 +0200)]
Implement thread watchdog
TL;DR Abort the high priority thread responsible for app startup if
it doesn't handle any events for 90s.
Recent defect
DF250609-00600 was reported because an application failed
to start within given time limit. The main security-manager thread was
handling the client request properly but there are no logs from the high
priority thread responsible for application startup. This suggests a
deadlock in this thread. We have no stack trace from security-manager
because it was application that has been aborted.
We can't do anything about the robustness tests log range so from now
on, the high priority thread will detect deadlocks by itself and abort
before the app is killed if the event processing takes too much time.
By crashing security-manager we'll get the stack trace and be able to
analyze the potential deadlock.
Note that the watchdog will not be triggered if an app startup request
is delayed because of many requests in the queue being processed slowly
but below the given timeout. In such case, it is assumed that the thread
is responsive and its logs should be visible. Still, it may lead to an
application being killed by amd.
Change-Id: Iaefe9bb831940756298751bcd1aee0d196ecce05
Zofia Abramowska [Thu, 5 Jun 2025 10:03:43 +0000 (12:03 +0200)]
Fix deadlock with license-manager
Some calls to security-manager (like app_has_privilege)
might, through cynara, call license-manager that in turn
calls security-manager API related to licensed privileges.
This commit add separate thread for handling that API.
Change-Id: I9ec6c902ed4031e5804c8e3d4d96d82a620925f5
Krzysztof Jackiewicz [Fri, 6 Jun 2025 07:22:13 +0000 (09:22 +0200)]
Release 2.0.8
* Replacement for realpath
* Fix logging errors for getpwnam_r/getgrnam_r
* Remove unnecessary code
* Log errno when stat() fails
Change-Id: I81e736cb315710fcd6d829f6ae8e1bbf3f2cbb02
Krzysztof Jackiewicz [Wed, 4 Jun 2025 13:29:26 +0000 (15:29 +0200)]
Replacement for realpath
The realpath() function does not honor CAP_DAC_OVERRIDE nor
CAP_DAC_READ_SEARCH when traversing the directory tree. As a result a
process having these capabilities not running as root may get EACCES
when calling realpath(). This an undocumented/implementation specific
"feature" of realpath. The problem occurred after dropping root (while
keeping caps) in security-manager.
To work around it a following approach has been applied:
1. Open the file descriptor to the path in question.
2. Once it's opened, a proper symlink should appear in /proc/<pid>/fd
pointing to the absolute canonicalized path.
3. Read the symlink target with readlink() to get that path.
Thanks to this replacement, the "system_share" group which was added
earlier to handle other realpath() related issue is no longer necessary
and it has been removed making security-manager rely on its
capabilities.
Change-Id: I98c8aa2668e098c04b472d57433617303ee4384e
Zofia Abramowska [Wed, 28 May 2025 13:43:15 +0000 (15:43 +0200)]
Fix logging errors for getpwnam_r/getgrnam_r
Change-Id: I20768d5bc994541ff22802c0d6d217ffa31276ae
Tomasz Swierczek [Wed, 28 May 2025 10:28:24 +0000 (12:28 +0200)]
Remove unnecessary code
Change-Id: I96846eefba9f6bb421adacfbbaca73fba876f53b
Zofia Abramowska [Thu, 15 May 2025 13:06:57 +0000 (15:06 +0200)]
Log errno when stat() fails
Change-Id: Ib1ea8050bd17ac7b00f33b4c4ec4a49bd397e258
Krzysztof Jackiewicz [Wed, 28 May 2025 13:09:21 +0000 (15:09 +0200)]
Release 2.0.7
* Fix app defined privileges issues
* Make app-defined privileges package-wide
* Make security-manager run without root
* Change default umask to 0026
Change-Id: I89dfb7351cd1dca2bfd173c627c9c3ef83ab9f09
Krzysztof Jackiewicz [Wed, 28 May 2025 11:02:48 +0000 (13:02 +0200)]
Fix app defined privileges issues
* Add unique constraint to prevent adding the privilege twice
* Remove view operations from migration script. View may be absent when
migrating from older db version. It will be created by executing
sql.db after the migration
* Fix app_private_sharing_view_insert_trigger which was using a
non-exsitent query parameter (NEW.pkg_name)
* Update unit tests to cover few more cases, including insert trigger
abort
Change-Id: Ieca89a6dfc75436dab37583a30bf72e3d5494fcf
Tomasz Swierczek [Fri, 9 May 2025 08:20:30 +0000 (10:20 +0200)]
Make app-defined privileges package-wide
Apps in same package (installed under same UID)
can all be declared to provide the same privilege.
Change-Id: Ibb9cc1a333b6457768624c17516066cc9c4b0970
Filip Skrzeczkowski [Mon, 26 May 2025 10:21:59 +0000 (12:21 +0200)]
Make security-manager run without root
Change-Id: I31c44c7e57f324aa08f393a4051b453928e45eb4
Dongsun Lee [Tue, 20 May 2025 05:25:54 +0000 (14:25 +0900)]
Change default umask to 0026
Change-Id: I259c36c3a7b4051d37df862b61cc9427e7697fd6
Krzysztof Jackiewicz [Tue, 20 May 2025 14:05:05 +0000 (16:05 +0200)]
Release 2.0.6
* Increase number of tgkill() attempts to 10
* Fix set_identity() call documentation to match implementation & assumptions
* Add more unit tests to increase code coverage
* Make getSystemAccessGid return sane value on smack-enabled system
Change-Id: I71db88eb83f2d20998ac4be0a90f4a27ac5576b5
Krzysztof Jackiewicz [Tue, 20 May 2025 13:37:08 +0000 (15:37 +0200)]
Increase number of tgkill() attempts to 10
During robustness tests the current 2 attempts may be not enough. There
are many applications running at the same time and it is suspected that
they reach the per-user pending signal limit. Robustness tests are also
executed on slower debug images which increases the chance of reaching
the limit.
According to VD kernel team a single retry after 10ms may be not enough
to free the signal queue.
This commit increases the number of retries from 2 to 10.
It is assumed that on release images the tgkill() should be handled
without retrying so this patch should not affect the regular app
startup.
Change-Id: Ifb90fa18a448ca887227a69d4673a8b63f317016
Tomasz Swierczek [Thu, 15 May 2025 07:31:14 +0000 (09:31 +0200)]
Fix set_identity() call documentation to match implementation & assumptions
Change-Id: I682fce4830f0f70e1c8bf90600c4de308e669608
Tomasz Swierczek [Thu, 17 Apr 2025 10:21:53 +0000 (12:21 +0200)]
Add more unit tests to increase code coverage
Change-Id: I72689bcc91ae6d7ad1f0fc31d1325b1b6ef45120
Tomasz Swierczek [Tue, 29 Apr 2025 15:16:19 +0000 (17:16 +0200)]
Make getSystemAccessGid return sane value on smack-enabled system
...to allow unit-testing of DacSetup class.
Change-Id: I9fa26fa68ef95d899a70d4e8cfce66be7bf46f3e
Krzysztof Jackiewicz [Wed, 30 Apr 2025 09:19:48 +0000 (11:19 +0200)]
Release 2.0.5
* Use the proper pid in pid->owner mapping
Change-Id: Ie43832994791e4c05bcec04492ca7000559a94d1
Krzysztof Jackiewicz [Wed, 30 Apr 2025 09:11:56 +0000 (11:11 +0200)]
Use the proper pid in pid->owner mapping
We should use the pid passed from client, not the client's pid.
Change-Id: Iedca1aad5d4a536a1f51f0b5c49fbdc4e725c988
Krzysztof Jackiewicz [Tue, 29 Apr 2025 09:40:06 +0000 (11:40 +0200)]
Release 2.0.4
* Fix issues reported by Coverity
* Add Boost Software License
Change-Id: I691c18573ef4b032f0559750fbb9a7d81c35bf36
Krzysztof Jackiewicz [Tue, 29 Apr 2025 09:28:00 +0000 (11:28 +0200)]
Fix issues reported by Coverity
Change-Id: I76a8dfe99ec826993133eb69b403659f584cef9a
Dongsun Lee [Thu, 24 Apr 2025 00:58:35 +0000 (09:58 +0900)]
Add Boost Software License
- The following files are under Boost Software License.
test/colour_log_formatter.h, test/colour_log_formatter.cpp
Change-Id: I7f682a9a06b550b8ed2680eeeb927322829d2eda
Tomasz Swierczek [Thu, 20 Mar 2025 12:31:14 +0000 (13:31 +0100)]
Release 2.0.3
* Return names of hybrid apps only
* Add security_manager_get_app_full_credentials_from_pid function
* Keep a pid->owner mapping
* Add errno abort helper
* Remove links to nonexistent wiki
* Remove unnecessary cynara async API usage
* Add setup of /run/user/<uid> for dynamically added users
* Path setup refactoring
Change-Id: Ie514b838113da10c61bc42e6e4db27587187deaf
Krzysztof Jackiewicz [Wed, 23 Apr 2025 11:30:15 +0000 (13:30 +0200)]
Return names of hybrid apps only
It's possible to identify a non-hybrid app using
PrivilegeDb::GetAppNameAndPkg if there is only one app installed but
this makes the identification API work differently depending on the
number of installed apps.
This is to make API return values consistent regardless of the number
of installed apps. Also match it with smack version behavior.
Change-Id: Ie76713d5aa0160bc5757b4019c20513e76baa89f
Tomasz Swierczek [Tue, 18 Mar 2025 14:09:01 +0000 (15:09 +0100)]
Add security_manager_get_app_full_credentials_from_pid function
Its meant to be a one-API-call replacement for usage of
security_manager_get_app_owner_uid & security_manager_identify_app_from_pid,
making only one round-trip to the server side.
Change-Id: I64b71dd4e6e50cf67a8106709da6f4e73918c3a7
Krzysztof Jackiewicz [Wed, 23 Apr 2025 12:22:59 +0000 (14:22 +0200)]
Keep a pid->owner mapping
Global applications are installed as a tizenglobalapp user (201) but are
launched as regular user (e.g. owner=5001). In smack-enabled image,
security_manager_get_app_owner_uid() returns the uid of the running app
(e.g. 5001) and not the uid of the user for whom the app was installed
(201).
This patch adds pid->owner mapping that keeps track of the original
process uid of each running app to be able to return it from above
function.
Change-Id: Ia190bb52d1dca61039eab0f879da8bb19cb04bd7
Krzysztof Jackiewicz [Mon, 14 Apr 2025 17:12:37 +0000 (19:12 +0200)]
Add errno abort helper
When allocations and logging are disallowed there's no way to get the
errno value. Add a helper that puts the errno value in the stack using
template functions.
Also move the end of no-allocation area after the last barrier bump.
Change-Id: I864c2104e2fa617feb8764e64e8e73673dd1e2d5
Tomasz Swierczek [Tue, 15 Apr 2025 08:51:23 +0000 (10:51 +0200)]
Remove links to nonexistent wiki
Change-Id: I5e13b94ee343dd3b618289deb00434a0c2449ae0
Tomasz Swierczek [Mon, 2 Dec 2024 02:35:44 +0000 (03:35 +0100)]
Remove unnecessary cynara async API usage
Change-Id: I2f0558b8bddf21c43e5edcf19bcb706be5a38160
Tomasz Swierczek [Tue, 18 Mar 2025 08:58:00 +0000 (09:58 +0100)]
Add setup of /run/user/<uid> for dynamically added users
Added remembering which users have their /run/user/<uid>
directory already setup & in case its not, proper chmod is added
to logic of prepare_app server-side call.
This way we don't need to modify upstream systemd & don't need to add
separate unit listening on contents of /run/user/ directory
for newly created user entries.
Reference: permissions for newly created user are configured
by systemd here:
https://review.tizen.org/gerrit/gitweb?p=platform/upstream/systemd.git;a=blob;f=src/login/user-runtime-dir.c;hb=
f2effd148a8337259d6efd0499d678e6fb52da46#l52
Change-Id: I67fa019a9006e0bbe900f4e1a0c16af83c8a1d22
Krzysztof Jackiewicz [Fri, 21 Feb 2025 17:52:57 +0000 (18:52 +0100)]
Path setup refactoring
* Split common and dac/smack specific code into separate files.
* Use common exceptions for Acl, Smack & Dac.
* Pass request uid to DacSetup::setupPkgBasePath and
DacSetup::setupPath.
Change-Id: If4e76a273e2bd11de6aad69d1f2c76a56a1c5bbd
Krzysztof Jackiewicz [Wed, 12 Mar 2025 14:29:58 +0000 (15:29 +0100)]
Release 2.0.2
* Implement uid sandboxing for private-sharing
* Change iptables rules for no-smack images
* Fix security_manager_set_identity with author id
* Simplify owner check for non-apps
* Set default ACL rules for directories only
* Ensure apps in the package have unique names
Change-Id: I1d2aa7e3980312422e4b08bb62d13f35bf823198
Zofia Abramowska [Mon, 10 Feb 2025 15:44:44 +0000 (16:44 +0100)]
Implement uid sandboxing for private-sharing
* Expand Acl and Acl::Entry to support entries modification
* Enable private sharing for nosmack environment
* Add Acl entries for shared path
* Remove Acl entries when sharing is dropped
* Remove all private sharing when target application is
uninstalled
Change-Id: Ie2645d972083df7e912a076f989f3a3f13ad7a33
Filip Skrzeczkowski [Fri, 7 Mar 2025 13:50:22 +0000 (14:50 +0100)]
Change iptables rules for no-smack images
In order to enable GID-based internet access
control on no-smack Tizen, provide a separate
iptables ruleset. It does not contain the SECMARK
label rule as it is not supported on no-smack
images.
Change-Id: Iddc31f005f544551989759f2cacc9689885c245b
Filip Skrzeczkowski [Fri, 28 Feb 2025 13:48:25 +0000 (14:48 +0100)]
Fix security_manager_set_identity with author id
Change-Id: Ia5e0712817c74704d6943eae6ed79e8d29713cea
Krzysztof Jackiewicz [Wed, 26 Feb 2025 09:56:58 +0000 (10:56 +0100)]
Simplify owner check for non-apps
Change-Id: Ieaf6b7a1b36911f9dd97680e0811ab0b716d2cae
Krzysztof Jackiewicz [Fri, 21 Feb 2025 15:38:54 +0000 (16:38 +0100)]
Set default ACL rules for directories only
Default ACL rules can be set on directories so that files and
directories created in them get the ACLs automatically.
The goal of this commit is to properly handle a rare case where an
application path is not a directory but a file.
Change-Id: Iac20c15e689b23486966649f2dc2222614942743
Krzysztof Malysa [Fri, 14 Feb 2025 16:59:07 +0000 (17:59 +0100)]
Ensure apps in the package have unique names
Change-Id: I6bf4af9657ddd37f3970148c1a3e660b510aa414
Tomasz Swierczek [Thu, 20 Feb 2025 10:35:56 +0000 (11:35 +0100)]
Release 2.0.1
* Add missing 'x' to others
* Take user from the request instead of credentials
* Fix Author's gid getter
* Fix trusted dir access
Change-Id: I3038391f92df506a06a0d3bf3ac6382e695a2319
Krzysztof Jackiewicz [Wed, 19 Feb 2025 10:25:53 +0000 (11:25 +0100)]
Add missing 'x' to others
Change-Id: I7e8f89b48c9fdcd5e31021560917bb19634b156a
Krzysztof Jackiewicz [Tue, 18 Feb 2025 17:12:26 +0000 (18:12 +0100)]
Take user from the request instead of credentials
Installation and path requests include and uid of the user on behalf of
which the request is processed. This is not always the same as the uid
of the calling process provided in Credentials.
Change-Id: I3d273770ef4d1a79e6be168e9dc6d94ecbf622af
Krzysztof Jackiewicz [Tue, 18 Feb 2025 15:01:33 +0000 (16:01 +0100)]
Fix Author's gid getter
Change-Id: If66f65ed01854c88b8229b4fe606ef7302d2107a
Krzysztof Jackiewicz [Fri, 14 Feb 2025 17:56:49 +0000 (18:56 +0100)]
Fix trusted dir access
Trusted path should not be accessible if there's no author. This may
happen if an app with trusted path is installed again without an author.
Change-Id: Ibe6506917e68b36d43cdf1ea701cf2c9c62a0e28
Tomasz Swierczek [Fri, 7 Feb 2025 09:40:51 +0000 (10:40 +0100)]
Release 2.0.0
“...reality, however utopian, is something from which
people feel the need of taking pretty frequent holidays....”
― Aldous Huxley, Brave New World
This release of security-manager intends NOT to differ at all in behaviour
on smack-enabled images.
Only one commit is related to bugfix on actual tizen branch that were done recenlty
on tizen_9.0 and tizen_8.0:
* Set HIGHEST priority to APP_CLEAN_NAMESPACE event
However, on images without smack (compiled with dev_wos GBS flag), this release
introduces UID-based sandboxing. Each app that would normally be sandbox-ed with its
unique Smack label, gets its own UID at launch (aka PUID). Like in smack-enabled
mode, hybrid apps in one package do get their individual PUIDs.
With this release (and paired cynara & security-config releases,
and also security-tests modifications to-date):
* application sandboxing works without Smack
* access control to app disk folders is done with DAC & ACLs
* privilege setup is done normally but for PUID
* cynara policy checks are configured to work based on caller's UID (PUID for apps)
As the no-smack compilation constitutes a PoC for now, there are some items not ready yet
that will be addressed in nearest future - as this release aims at unblocking modifications
of the rest of the system for the no-smack mode.
Known issues
------------
* internet & app debugging access control - used to be done with Smack, now its just permissive mode
* private sharing API between apps is not ported to use PUID and DAC yet (implementation in progress)
* not all security-tests pass in no-smack mode (work in progress on adjustment)
* migration script needs to be added IF this would get pushed to a device running previous Tizen versions
(migration of DB, ACL permissions, etc. needed).
* (not dependent on security FW): the no-smack image may not boot homescreen due to launchpad issues
* (not dependent on security FW): access to parent directory of app sandbox may be blocked & changes
in gumd may be needed (change to 755 in /etc/gumd/useradd.d/91_user-dbspace-permissions.post)
* (not dependent on security FW, mitigated here): access to /run/user/5001 for others is added
on daemon startup to allow apps access (this should be re-engineered for multiuser later)
After this release, launchpad & aul-1 & other Tizen components need to adjust themselves
to new policy configuration in the absence of Smack.
Change-Id: Ib92c84e3216b663d68f631abb8469419f860c157
Krzysztof Jackiewicz [Fri, 14 Feb 2025 16:28:42 +0000 (17:28 +0100)]
Add system_access to forbidden groups
Change-Id: Ied3b85b25b348529ea74d748719464accb6d7d64
Dariusz Michaluk [Mon, 10 Feb 2025 11:10:13 +0000 (12:10 +0100)]
Set HIGHEST priority to APP_CLEAN_NAMESPACE event
Change-Id: Id6513fd06ccdb631d0a2f550e25cc968adbf402a
Tomasz Swierczek [Fri, 14 Feb 2025 11:11:04 +0000 (12:11 +0100)]
Configure app access to /run/user/<uid> for existing users
Apps are least privileged entities in the OS and need access to that diretory.
This is a temporary solution - long term, a group would have to be created
for each real user & that user's (that UID's) path would need to be accessible
only to apps having that group. This commit is a workaround to enable further
work on no-smack images.
Change-Id: I6bd1d0df8939d47813b7f3807551b455b0b72ec1
Krzysztof Jackiewicz [Tue, 11 Feb 2025 11:45:03 +0000 (12:45 +0100)]
Use app PUID when checking path privileges
Change-Id: I6015afe994f88362f48bca2c54cbaa6564328681
Filip Skrzeczkowski [Wed, 5 Feb 2025 16:28:08 +0000 (17:28 +0100)]
Make app identification APIs work on no-smack
Change-Id: I439afdccf91f6d677661cb52fa14ff6e14be4b11
Filip Skrzeczkowski [Wed, 29 Jan 2025 19:35:09 +0000 (20:35 +0100)]
Implement security_manager_get_app_owner_uid for no-smack tizen
Test with security_manager_26_1_security_manager_get_app_owner_uid in no-smack mode.
Change-Id: I5890289df072f5113caba8231aa125a332a48dd8
Krzysztof Malysa [Fri, 7 Feb 2025 14:46:03 +0000 (15:46 +0100)]
Restore client authentication
Change-Id: I5b73fd3f5523ce8002fca6d912552c3527291f63
Krzysztof Malysa [Mon, 3 Feb 2025 15:00:33 +0000 (16:00 +0100)]
Use process UID as user for app permissions in cynara
All tests from group SECURITY_MANAGER_PREPARE_APP should work on
no-smack image. Additionally the below tests should pass:
- security_manager_01a_app_double_install_double_uninstall
- security_manager_01b_app_double_install_wrong_pkg_id
- security_manager_01c_app_uninstall_wrong_pkg_id
- security_manager_01d_app_install_complicated_dir_tree
- security_manager_02_app_install_uninstall_full
- security_manager_02a_set_process_groups
- security_manager_04b_app_install_by_root_for_app_user
- security_manager_05_drop_process_capabilities
- security_manager_06_install_app_offline
- security_manager_07a_user_add_app_install
- security_manager_07b_user_add_offline
- security_manager_08_user_double_add_double_remove
- security_manager_09a_install_many_apps_in_single_request
- security_manager_09c_update_many_apps_in_single_request_hybrid_package
- security_manager_09d_uninstall_app_from_hybrid_package
- security_manager_09e_update_app_nonhybrid_package
- security_manager_09f_update_app_hybrid_package
- security_manager_10_app_has_privilege
- security_manager_24_groups_get
- security_manager_25a_global_user_set_install_type_global
- security_manager_26_hybrid_pkg_uninstall_artifacts_check
Change-Id: I91d79f8f829de08d71b5068a82ac278813f9dba7
Krzysztof Malysa [Thu, 30 Jan 2025 14:42:16 +0000 (15:42 +0100)]
Add migrating apps installed as if in smack mode on no-smack image
Change-Id: I7b147eee82fe00dcaedf57cfbb7a5b1a973083d3
Krzysztof Malysa [Thu, 30 Jan 2025 11:32:02 +0000 (12:32 +0100)]
Adjust cynara policy to use UIDs instead of Smack labels on no-smack image
Change-Id: I7a4dbd3799e58cdb90f5f43be01869e68bb31b81
Krzysztof Jackiewicz [Wed, 22 Jan 2025 15:20:55 +0000 (16:20 +0100)]
Setup paths using DAC
Change-Id: I7841eb8807e16190d0c1b733be498775413f8af5
Krzysztof Jackiewicz [Mon, 27 Jan 2025 20:13:23 +0000 (21:13 +0100)]
Refactor smack labeling
Change-Id: Ife4a8f6cbda9261bb3b7e778feda939200582671
Krzysztof Jackiewicz [Mon, 3 Feb 2025 15:53:25 +0000 (16:53 +0100)]
Acl tests
Change-Id: Ic0f8bcf612681bba6f088d48083d68ff1f2fe8dd
Krzysztof Malysa [Wed, 12 Feb 2025 14:53:36 +0000 (15:53 +0100)]
Fix ACL helper
Change-Id: I3273fb0ccd43c61650e714dd9793557ab4fa9e03
Krzysztof Jackiewicz [Wed, 22 Jan 2025 15:20:04 +0000 (16:20 +0100)]
Add ACL helper
Change-Id: Ie21acf4a60d67242f896d89bbf16d3167e549a44
Krzysztof Jackiewicz [Mon, 27 Jan 2025 15:00:44 +0000 (16:00 +0100)]
Remove unused exec labeling code
Change-Id: I1047cccca03e686eef003da63410be3290c1ce01
Krzysztof Jackiewicz [Thu, 30 Jan 2025 13:38:43 +0000 (14:38 +0100)]
Refactor path_req
* Structure is now serializable so we can get rid of member-by-member
(de)serialization
* Change installationType type to app_install_type so that it better
reflects the actual type stored in it.
Change-Id: I33021a8cb34481b981f84bb01d6388da848bf165
Krzysztof Jackiewicz [Thu, 30 Jan 2025 09:51:19 +0000 (10:51 +0100)]
Remove permissible file logic in no-smack
Change-Id: Iceb1d9556c93f04a6f659a3c48603fa2a4f8e870
Krzysztof Jackiewicz [Wed, 22 Jan 2025 08:48:29 +0000 (09:48 +0100)]
Refactor labelPaths
Change-Id: I4a1280bb857c47435da7a00c7744cf61f41ab0c2
Krzysztof Jackiewicz [Tue, 21 Jan 2025 15:36:17 +0000 (16:36 +0100)]
Add libacl dependency
Change-Id: I9e7865e3b60014afecb21748a2304eae47875d0b
Krzysztof Jackiewicz [Tue, 21 Jan 2025 09:25:38 +0000 (10:25 +0100)]
Add gid-by-name getter
Change-Id: I0e6b2ea2777338a3599ca23eb0d1255a43fb7f01
Krzysztof Jackiewicz [Tue, 28 Jan 2025 11:24:52 +0000 (12:24 +0100)]
Disable Shared RO namespaces in no-smack
We can express the policy (RW for owners and system, RO for others)
using ACL and DAC.
Change-Id: Ia9f1951311c080e265f0d4fe4b4af5fcb9289368
Krzysztof Jackiewicz [Tue, 21 Jan 2025 08:57:49 +0000 (09:57 +0100)]
Enable proper drop check
Change-Id: I55f035dd70282ebae8c75220b8e6ad4624b84f25
Krzysztof Jackiewicz [Tue, 21 Jan 2025 08:54:33 +0000 (09:54 +0100)]
Unlock security_manager_drop_process_privileges
The following test should pass:
security_manager_05_drop_process_capabilities
Change-Id: I444ef19f189052e42efdcd08849488c71815e043
Krzysztof Jackiewicz [Tue, 21 Jan 2025 08:26:30 +0000 (09:26 +0100)]
Enable namespace setup & cleanup in no-smack
Following security-manager-tests should pass:
security_manager_101_create_namespace_test_n
security_manager_101_create_namespace_test_p
Change-Id: I73936afc1f12f26ae94e20bcae2f63ec028163f7
Krzysztof Jackiewicz [Mon, 20 Jan 2025 11:12:13 +0000 (12:12 +0100)]
Use process UId & author GId in app preparation
* Replace smack label with UId in app preparation
* Add author GId to app supplementary groups if available
* Setuid before capability drop (otherwise supplementary threads won't
be able to drop it).
* Don't wait for signal handlers to complete. Capset() should not
affect inter-thread communication.
* Require CAP_SETUID in pre-check.
* Pass process UId to cynara upon installation & deinstallation.
* Return no-smack label from label generation functions.
* Modify first free process UId and author GId lookup function to ignore
existing smack-enabled apps with lower ids. This is to allow testing on
databases containing smack-enabled apps.
* Add unit tests.
All unit tests should pass in both smack and no-smack modes.
The following security-manager-tests should pass in no-smack mode:
security_manager_100_synchronize_credentials_test
security_manager_100_synchronize_credentials_no_author_test
security_manager_190_prepare_app_threads_malloc
security_manager_300_prepare_app_recursive_threads
security_manager_400_prepare_app_with_concurrent_install
security_manager_400_prepare_app_series_with_concurrent_install_stress
Change-Id: I390e957cc60576f92bd925ff0be227fdb760648a
Krzysztof Jackiewicz [Thu, 16 Jan 2025 09:42:17 +0000 (10:42 +0100)]
Skip author hash in no-smack mode
Change-Id: If0496a4455f06759b16c2e2156f0d8eadb6b574c
Krzysztof Jackiewicz [Tue, 14 Jan 2025 14:48:24 +0000 (15:48 +0100)]
Disable smack label tests
Change-Id: I6f0309a0cff114214361b972739785094e5552ae
Krzysztof Jackiewicz [Tue, 14 Jan 2025 10:52:45 +0000 (11:52 +0100)]
Disable rules-loader test in no-smack mode
Rules loader produces no output in no-smack mode
Change-Id: I20bdd7b38545093c8a371f79be873821b311ad53
Krzysztof Jackiewicz [Wed, 8 Jan 2025 15:51:19 +0000 (16:51 +0100)]
Skip CAP_MAC_ADMIN check in no-smack mode
Change-Id: I10dfed5983d3ef1d6f03256e3bbe43fb2461c45d
Krzysztof Jackiewicz [Thu, 2 Jan 2025 14:37:39 +0000 (15:37 +0100)]
Add process UId and author GId support in no-smack mode
The process UId is an equivalent of a process smack label. Therefore,
it must follow the hybridity rules:
1. For non-hybrid apps, all apps in the package must have the same
process UId.
2. For hybrid apps, each app must have a different process UId.
To achieve that, the process UId equal to pkg_id for non-hybrid apps
and equal to app_id for hybrid apps.
The author GId is always equal to author_id.
During app installation in no-smack mode, the pkg_id, app_id and
author_id are selected as follows:
1. author_id is set to the smallest unused value starting from 20000.
2. pkg_id and app_id are set to the smallest value unused in both
pkg_id from table pkg and app_id from table app starting from 10000.
To achieve that, the StmtType::EAddApplication and
user_app_pkg_view_insert_trigger have been adjusted to accept 3
additional arguments (pkg_id, app_id and author_id). Setting them to
null in smack-enabled mode makes sqlite assign these values as before
(see https://www.sqlite.org/quirks.html#primary_keys_can_sometimes_contain_nulls).
If an app being installed in no-smack mode belongs to an existing
package or author, the corresponding "INSERT OR IGNORE" on pkg or
author table will fail, making the rest of the query reuse existing
values.
Add statements facilitating pkg_id, app_id & author_id lookup.
Bump db version to apply view change.
Add unit tests (test suite: PRIVILEGE_DB_TEST_PROCESS_UID_AUTHOR_GID).
Change-Id: I7cfaf7bc552b7ee3b1166024707f22d8af7c1a8d
Tomasz Swierczek [Wed, 5 Feb 2025 07:18:20 +0000 (08:18 +0100)]
Release 1.9.18
* Change the way we pre-load symbol for syscall by calling it
Change-Id: Iee6cf0a127c50c5dfb9b44e88fad0f86857c1334
Tomasz Swierczek [Wed, 5 Feb 2025 07:05:06 +0000 (08:05 +0100)]
Change the way we pre-load symbol for syscall by calling it
Apparently using -1 as invalid argument can fail with SIGILL
on some configurations (happened on VD side).
Change-Id: I26d1d0411c637a67888a8d1e73892171004d05a3
Tomasz Swierczek [Thu, 16 Jan 2025 12:37:01 +0000 (13:37 +0100)]
Release 1.9.17
* Fix possible issue with lazy-symbol binding
Change-Id: I813fc8f6d1e61d01937664e09a1e8ee2546391ab
Tomasz Swierczek [Thu, 16 Jan 2025 12:30:17 +0000 (13:30 +0100)]
Fix possible issue with lazy-symbol binding
It seems possible that lazy binding of the SO symbols loaded by linker can cause problems
when the SIGSETXID arrives in some thread at the precise moment that a symbol in a thread
is being lazy-initialized. By doing calls below we're ensuring that symbols used inside
our handler are already loaded - lazy symbols (or any not-loaded) should not be called inside
a handler.
Also, changed the handler to be a regular function for easier debugging in kernel team.
Change-Id: I6a293374c38f47b18af86166d8b150af55469739
Tomasz Swierczek [Thu, 9 Jan 2025 05:53:52 +0000 (06:53 +0100)]
Release 1.9.16
* Add security_manager_is_app_from_pid() function
Change-Id: Iea0b4651a91b39cf4db20f82db2b722a4113d82a
Tomasz Swierczek [Wed, 8 Jan 2025 07:15:41 +0000 (08:15 +0100)]
Add security_manager_is_app_from_pid() function
Change-Id: I53ed6e507a945e1829e851621e521417bef831b5
Krzysztof Jackiewicz [Tue, 31 Dec 2024 13:04:49 +0000 (14:04 +0100)]
Release 1.9.15
* Mark thread as dead in case of ESRCH
* Disable logging during thread sync
* Remove log from get_alive_threads()
* Put abort() in place to facilitate debugging
Change-Id: I7e56ad62b4338ddc0149bf322d155f939ecd478f
Krzysztof Jackiewicz [Tue, 31 Dec 2024 12:33:27 +0000 (13:33 +0100)]
Mark thread as dead in case of ESRCH
This may speed up the thread sync a bit
Change-Id: Ib6a9c8f11a719615227efd24da18c65b91d69bf0
Krzysztof Jackiewicz [Tue, 31 Dec 2024 10:58:40 +0000 (11:58 +0100)]
Disable logging during thread sync
Change-Id: I78e3154a6f5ae4697a461a0cbcce4affca2f50dd
Krzysztof Jackiewicz [Tue, 31 Dec 2024 10:30:50 +0000 (11:30 +0100)]
Remove log from get_alive_threads()
No allocations allowed during thread sync
Change-Id: I3e539c4572ccfba96ba798383c1eea7d0260cd44
Krzysztof Jackiewicz [Tue, 31 Dec 2024 09:36:55 +0000 (10:36 +0100)]
Put abort() in place to facilitate debugging
This way the backtrace will show us the point of failure
Change-Id: I97f70db007661b91baa757442b01c0cdc3270a5b
Dongkyun Son [Tue, 5 Nov 2024 08:28:46 +0000 (17:28 +0900)]
packaging: asan: skip Werror=stringop-overread
Change-Id: I10972a6d7bb01cc2d7e017b4d2a06189e33f674f
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Tomasz Swierczek [Thu, 19 Dec 2024 08:11:52 +0000 (09:11 +0100)]
Release 1.9.14
* Change runtime Smack check in dev_wos cases to compile-time
* Add argument check to security_manager_set_identity()
Change-Id: I6ff748258a07d98c32d31f43c2b9e30a65f2dc9a
Tomasz Swierczek [Thu, 19 Dec 2024 08:01:08 +0000 (09:01 +0100)]
Change runtime Smack check in dev_wos cases to compile-time
Previous patch didn't work for PontusM smack-enabled environment.
Now this patch ensures that WITHOUT dev_wos flag, there is definitely
no difference in logic of security-manager, even in the absence of Smack
(ie. during image creation).
Change-Id: If37d9ceae8bcb5727e82f7310acff0358b820240
Jan Wojtkowski [Wed, 18 Dec 2024 11:30:04 +0000 (12:30 +0100)]
Add argument check to security_manager_set_identity()
Change-Id: Ibac8f33ae7eaef9bff7b67fdea53bc6f82591fbb
Tomasz Swierczek [Fri, 13 Dec 2024 12:53:28 +0000 (13:53 +0100)]
Release 1.9.13
* Change process_type elements with additional prefix
Change-Id: I5eb61bbc15a5aa8b8cc66ef046e2fb4f280d6605
Tomasz Swierczek [Fri, 13 Dec 2024 12:24:23 +0000 (13:24 +0100)]
Change process_type elements with additional prefix
askuser-notification couldn't be built because of ambiguity
in the APIs/enums.
Also, added missing header.
Change-Id: I1dbc4ef6cac4cdf74db200b85b790424d3b03ee4
Tomasz Swierczek [Thu, 12 Dec 2024 09:56:11 +0000 (10:56 +0100)]
Release 1.9.12
* Make security_manager_set_identity() and security_manager_self_is_app() work in dev_wos env
* Add function security_manager_set_identity()
* Add function security_manager_get_app_owner_uid()
* Silence SVACE warning
* Add function security_manager_self_is_app()
* Add security-manager permissive mode build option - dev_wos
Change-Id: I3c225668a16f500fd875a951534b4754e73bb4a2
Tomasz Swierczek [Thu, 12 Dec 2024 09:50:39 +0000 (10:50 +0100)]
Make security_manager_set_identity() and security_manager_self_is_app() work in dev_wos env
Change-Id: I42437b6db64b5beb20c06339ae8f782e15562bf4
Jan Wojtkowski [Fri, 29 Nov 2024 10:17:32 +0000 (11:17 +0100)]
Add function security_manager_set_identity()
Change-Id: Iec954c9a41cbf0547de685590685fdbf2b03e5d6
Tomasz Swierczek [Thu, 12 Dec 2024 09:32:58 +0000 (10:32 +0100)]
Add function security_manager_get_app_owner_uid()
Change-Id: Ie8281381b9c2ce509aec7ef3f5a0dbdcf7e58a1f
Tomasz Swierczek [Tue, 19 Nov 2024 09:51:05 +0000 (10:51 +0100)]
Silence SVACE warning
Change-Id: Ib9baacdbdd47f197b39c530a2b5bff75e0fc944e