This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2215525 - fapolicyd needs to make sure the FD limit is never reached
Summary: fapolicyd needs to make sure the FD limit is never reached
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: fapolicyd
Version: 9.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Radovan Sroka
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On: 2181470
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-16 11:19 UTC by Radovan Sroka
Modified: 2023-06-16 12:04 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2181470
Environment:
Last Closed: 2023-06-16 12:03:58 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-623 0 None None None 2023-06-16 12:03:58 UTC
Red Hat Issue Tracker RHELPLAN-160063 0 None None None 2023-06-16 11:21:02 UTC
Red Hat Issue Tracker SECENGSP-5253 0 None None None 2023-06-16 11:21:11 UTC

Description Radovan Sroka 2023-06-16 11:19:49 UTC
+++ This bug was initially created as a clone of Bug #2181470 +++

Description of problem:

Since the queue size (q_size) can be set to a large value, it's necessary for fapolicyd to ensure the current soft limit won't be reached, or else some undefined behavior may happen (I didn't check what would be the consequence yet).

By default, fapolicyd service use has a soft limit of 1024:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# cat /proc/1792/limits 
Limit                     Soft Limit           Hard Limit           Units     
[...]
Max open files            1024                 262144               files     
[...]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Potentially, if a customer sets a larger q_size than RHEL's default (640), e.g. uses the default value from manpage (1024), it's possible the limit gets reached.

Version-Release number of selected component (if applicable):

fapolicyd-1.1.3-8.el8_7.1.x86_64

How reproducible:

N/A

--- Additional comment from Steve Grubb on 2023-03-24 16:07:28 UTC ---

NOFILE gets set to infinity: https://github.com/linux-application-whitelisting/fapolicyd/blob/main/src/daemon/fapolicyd.c#L516

I don't think we have a problem here.

--- Additional comment from Steve Grubb on 2023-03-24 17:20:09 UTC ---

Actually...systemd is the problem. Anyone wanting more can add LimitNOFILE=16383  or whatever they want. I'll add this to the upstream service file. Also looks like systemd prohibits changing priority as well.

--- Additional comment from Takayuki Nagata on 2023-03-27 07:26:20 UTC ---

> Since the queue size (q_size) can be set to a large value, it's necessary for fapolicyd to ensure the current soft limit won't be reached, or else some undefined behavior may happen (I didn't check what would be the consequence yet).

I have just reviewed kernel code, and it appears to me that reading fanotify fd returns -EMFILE when fapolicyd's open files reach the limit. So the fapolicyd cannot get fanotify_event_metadata from the fd, but after closing open files, it will return the fanotify_event_metadata that cannot be returned before.

Comment 1 Radovan Sroka 2023-06-16 12:00:41 UTC
This bug is going to be migrated.

Contact point for migration questions or issues: rsroka
Guidance for Bugzilla users to test their Jira account or create one if needed:

https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016394
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016694
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016774

Comment 2 Radovan Sroka 2023-06-16 12:03:58 UTC
The bugzilla has been migrated to Jira and is now available in the RHEL ticket, where it will continue its lifecycle.


Note You need to log in before you can comment on or make changes to this bug.