From: Stephen Hemminger <stephen@networkplumber.org>
To: Jake Freeland <jfree@freebsd.org>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
dev <dev@dpdk.org>
Subject: Re: [PATCH 3/3] eal/linux: Check hugepage access permissions
Date: Wed, 7 May 2025 17:52:19 +0900 [thread overview]
Message-ID: <CAOaVG142x9ENgVF_p2GuhYA7wRuSXN83=__4D_+kXvxghZB-mg@mail.gmail.com> (raw)
In-Reply-To: <20250506175010.1141585-4-jfree@FreeBSD.org>
[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]
Please don't split message a across multiple lines.
Open and access are not the same in all security checks, so not a great
idea.
Some analyzer tools may flag as time of check, time of use issue.
On Wed, May 7, 2025, 02:50 Jake Freeland <jfree@freebsd.org> wrote:
> Currently, hugepage mountpoints will be used irrespective of permissions,
> leading to potential EACCES errors during memory allocation. Fix this by
> not using a mountpoint if we do not have read/write permissions on it.
>
> Signed-off-by: Jake Freeland <jfree@FreeBSD.org>
> ---
> lib/eal/linux/eal_hugepage_info.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/lib/eal/linux/eal_hugepage_info.c
> b/lib/eal/linux/eal_hugepage_info.c
> index d47a19c56a..dbfa38b05c 100644
> --- a/lib/eal/linux/eal_hugepage_info.c
> +++ b/lib/eal/linux/eal_hugepage_info.c
> @@ -260,6 +260,12 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir,
> int len)
> continue;
> }
>
> + if (access(splitstr[MOUNTPT], R_OK | W_OK) < 0) {
> + EAL_LOG(NOTICE, "Missing r/w permissions on huge
> dir: "
> + "'%s'. Skipping it", splitstr[MOUNTPT]);
> + continue;
> + }
> +
> /*
> * If no --huge-dir option has been given, we're done.
> */
> -
>
>
[-- Attachment #2: Type: text/html, Size: 2186 bytes --]
next prev parent reply other threads:[~2025-05-07 8:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 17:50 [PATCH 0/3] EAL memory fixes Jake Freeland
2025-05-06 17:50 ` [PATCH 1/3] eal/freebsd: Do not use prev_ms_idx for hole detection Jake Freeland
2025-05-08 10:31 ` Burakov, Anatoly
2025-05-08 11:05 ` Burakov, Anatoly
2025-05-06 17:50 ` [PATCH 2/3] eal/freebsd: Do not index out of bounds in memseg list Jake Freeland
2025-05-08 11:20 ` Burakov, Anatoly
2025-05-06 17:50 ` [PATCH 3/3] eal/linux: Check hugepage access permissions Jake Freeland
2025-05-07 8:52 ` Stephen Hemminger [this message]
2025-05-07 16:09 ` Jake Freeland
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='CAOaVG142x9ENgVF_p2GuhYA7wRuSXN83=__4D_+kXvxghZB-mg@mail.gmail.com' \
--to=stephen@networkplumber.org \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jfree@freebsd.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).