From: Stephen Hemminger <stephen@networkplumber.org>
To: liujie5@linkdatatechnology.com
Cc: dev@dpdk.org
Subject: Re: [PATCH v4 3/9] drivers: add sxe2 basic structures
Date: Thu, 30 Apr 2026 20:05:14 -0700 [thread overview]
Message-ID: <20260430200514.0053998c@phoenix.local> (raw)
In-Reply-To: <20260501015925.263486-4-liujie5@linkdatatechnology.com>
On Fri, 1 May 2026 09:59:18 +0800
liujie5@linkdatatechnology.com wrote:
> From: Jie Liu <liujie5@linkdatatechnology.com>
>
> This patch adds the base infrastructure for the sxe2 common
> library. It includes the mandatory OS abstraction layer (OSAL),
> common structure definitions, error codes, and the logging
> system implementation.
>
> Specifically, this commit:
> - Implements the logging stream management using RTE_LOG_LINE.
> - Defines device-specific error codes and status registers.
> - Adds the initial meson build configuration for the common library.
>
> Signed-off-by: Jie Liu <liujie5@linkdatatechnology.com>
> ---
NAK.
NAK.
DPDK drivers must not reinvent their own logging, and they absolutely
must not hijack the log stream that is shared with the application and
the rest of DPDK. This patch does both.
Concrete problems in what you posted:
1. PMD_LOG_NOTICE/WARN/ERR/CRIT/ALERT/EMERG call
rte_openlog_stream(g_sxe2_common_log_fp) before logging and
rte_openlog_stream(NULL) after. rte_openlog_stream() sets the
*global* DPDK log stream for the entire application. A driver has
no business deciding where the application's logs go. As written,
this will silently redirect every other PMD's, every library's,
and the application's own output any time sxe2 emits a message.
2. Those same macros emit the message twice -- once before the stream
is swapped and once after -- so every NOTICE/WARN/ERR comes out
duplicated.
3. Drivers must not open files. fopen("/var/log/sxe2pmd.log.<ts>",
"w+") from inside a PMD is a security problem on every level:
- It runs with whatever privileges the application has, which for
DPDK is typically root or CAP_*-loaded. Creating files in
/var/log under those privileges is a classic symlink / TOCTOU
attack surface.
- The path is attacker-influenceable in the timestamp component
and is not created with O_CREAT|O_EXCL, no mode argument, no
directory fd, none of the hardening you would expect.
- Log content is written without any escaping; anything an
attacker can get into a log message ends up in a file the
operator will later cat or grep.
- It bypasses whatever logging policy the operator, distro,
systemd unit, container runtime, SELinux/AppArmor profile, or
application has configured. A driver silently writing to
/var/log is exactly the kind of thing those policies exist to
prevent.
- It doesn't work for non-root users, in unprivileged containers,
on read-only rootfs systems, or on Windows.
Drivers log through rte_log. The application decides where those
logs go. Full stop.
4. RTE_LOG_REGISTER_SUFFIX(..., com, DEBUG) defaults the log type to
DEBUG. The default level is the application's choice, not the
driver's.
5. SXE2_DPDK_DEBUG is unconditionally defined in
drivers/common/sxe2/meson.build, so the "debug" path with the file
hijacking is always on. There is no off switch.
6. SXE2_PMD_LOG adds a thread id, basename, line number, and function
name to every line. If those are useful, they are useful for every
driver -- not just yours.
General principles, which apply to every driver:
- Drivers do not reinvent logging. Use RTE_LOG / RTE_LOG_LINE and a
log type registered for the driver. That is it.
- Drivers do not open files, and do not change logging behavior that
is shared with the application or with other drivers. Both have
security implications well beyond this driver.
- If something is genuinely missing from the common logging
infrastructure -- per-driver log files, richer prefixes, thread
ids, structured fields, whatever -- propose it as a change to
lib/log so every driver and every application benefits, and so it
gets reviewed for security by people who do that for a living. Do
not bury it inside one driver.
- "It works for our embedded use case" is not an argument. DPDK runs
on Linux, FreeBSD, and Windows; on x86, Arm, POWER, and RISC-V; in
bare metal, VMs, and containers; as root and as unprivileged users.
A driver has to behave reasonably in all of those.
- Once we make an exception for one driver, every subsystem will
expect one. That is not happening.
Please drop sxe2_common_log.c and sxe2_common_log.h entirely. Use the
existing RTE_LOG_* macros directly against a log type registered for
your driver, and respect the level and stream that the application
has configured.
While you're at it, the same "this driver is a special snowflake"
pattern shows up elsewhere in this series and gets the same answer:
- sxe2_type.h redefines u8/u16/u32/u64/s8/.../__le16/__be32 instead
of using uintN_t and rte_beN_t.
- sxe2_errno.h reinvents errno values that already exist.
- sxe2_osal.h re-implements bitmap operations, allocation wrappers,
and an OS abstraction layer that DPDK already provides.
This is the cost of being part of a shared community project across
many platforms and architectures. Please rework on that basis before
reposting.
Stephen
PS: AI revised this text, my initial version was probably
not safe for public consumption.
next prev parent reply other threads:[~2026-05-01 3:05 UTC|newest]
Thread overview: 143+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 7:01 [PATCH v1 0/9] common/sxe2: add common functions for sxe2 driver liujie5
2026-04-30 7:01 ` [PATCH v1 1/9] mailmap: add Jie Liu liujie5
2026-04-30 7:01 ` [PATCH v1 2/9] doc: add sxe2 guide and release notes liujie5
2026-04-30 7:01 ` [PATCH v1 3/9] drivers: add sxe2 basic structures liujie5
2026-04-30 7:01 ` [PATCH v1 4/9] common/sxe2: add base driver skeleton liujie5
2026-04-30 7:01 ` [PATCH v1 5/9] drivers: add base driver probe skeleton liujie5
2026-04-30 7:01 ` [PATCH v1 6/9] drivers: support PCI BAR mapping liujie5
2026-04-30 7:01 ` [PATCH v1 7/9] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-04-30 7:01 ` [PATCH v1 8/9] net/sxe2: support queue setup and control liujie5
2026-04-30 7:01 ` [PATCH v1 9/9] net/sxe2: add data path for Rx and Tx liujie5
2026-04-30 9:22 ` [PATCH v2 0/9] net/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-04-30 9:22 ` [PATCH v2 1/9] mailmap: add Jie Liu liujie5
2026-04-30 9:22 ` [PATCH v2 2/9] doc: add sxe2 guide and release notes liujie5
2026-04-30 9:22 ` [PATCH v2 3/9] drivers: add sxe2 basic structures liujie5
2026-04-30 9:22 ` [PATCH v2 4/9] common/sxe2: add base driver skeleton liujie5
2026-04-30 9:22 ` [PATCH v2 5/9] drivers: add base driver probe skeleton liujie5
2026-04-30 9:22 ` [PATCH v2 6/9] drivers: support PCI BAR mapping liujie5
2026-04-30 9:22 ` [PATCH v2 7/9] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-04-30 9:22 ` [PATCH v2 8/9] net/sxe2: support queue setup and control liujie5
2026-04-30 9:22 ` [PATCH v2 9/9] net/sxe2: add data path for Rx and Tx liujie5
2026-04-30 10:18 ` [PATCH v3 0/9] net/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-04-30 10:18 ` [PATCH v3 1/9] mailmap: add Jie Liu liujie5
2026-04-30 10:18 ` [PATCH v3 2/9] doc: add sxe2 guide and release notes liujie5
2026-04-30 10:18 ` [PATCH v3 3/9] drivers: add sxe2 basic structures liujie5
2026-04-30 10:18 ` [PATCH v3 4/9] common/sxe2: add base driver skeleton liujie5
2026-04-30 10:18 ` [PATCH v3 5/9] drivers: add base driver probe skeleton liujie5
2026-04-30 10:18 ` [PATCH v3 6/9] drivers: support PCI BAR mapping liujie5
2026-04-30 10:18 ` [PATCH v3 7/9] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-04-30 10:18 ` [PATCH v3 8/9] net/sxe2: support queue setup and control liujie5
2026-04-30 10:18 ` [PATCH v3 9/9] net/sxe2: add data path for Rx and Tx liujie5
2026-05-01 1:59 ` [PATCH v4 0/9] net/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-05-01 1:59 ` [PATCH v4 1/9] mailmap: add Jie Liu liujie5
2026-05-01 1:59 ` [PATCH v4 2/9] doc: add sxe2 guide and release notes liujie5
2026-05-01 1:59 ` [PATCH v4 3/9] drivers: add sxe2 basic structures liujie5
2026-05-01 3:05 ` Stephen Hemminger [this message]
2026-05-01 1:59 ` [PATCH v4 4/9] common/sxe2: add base driver skeleton liujie5
2026-05-01 1:59 ` [PATCH v4 5/9] drivers: add base driver probe skeleton liujie5
2026-05-01 1:59 ` [PATCH v4 6/9] drivers: support PCI BAR mapping liujie5
2026-05-01 1:59 ` [PATCH v4 7/9] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-01 1:59 ` [PATCH v4 8/9] net/sxe2: support queue setup and control liujie5
2026-05-01 1:59 ` [PATCH v4 9/9] net/sxe2: add data path for Rx and Tx liujie5
2026-05-01 3:33 ` [PATCH v5 0/9] net/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-05-01 3:33 ` [PATCH v5 1/9] mailmap: add Jie Liu liujie5
2026-05-01 3:33 ` [PATCH v5 2/9] doc: add sxe2 guide and release notes liujie5
2026-05-01 3:33 ` [PATCH v5 3/9] drivers: add sxe2 basic structures liujie5
2026-05-01 14:46 ` Stephen Hemminger
2026-05-01 3:33 ` [PATCH v5 4/9] common/sxe2: add base driver skeleton liujie5
2026-05-01 3:33 ` [PATCH v5 5/9] drivers: add base driver probe skeleton liujie5
2026-05-01 3:33 ` [PATCH v5 6/9] drivers: support PCI BAR mapping liujie5
2026-05-01 3:33 ` [PATCH v5 7/9] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-01 3:33 ` [PATCH v5 8/9] net/sxe2: support queue setup and control liujie5
2026-05-01 3:33 ` [PATCH v5 9/9] net/sxe2: add data path for Rx and Tx liujie5
2026-05-06 2:12 ` [PATCH v6 00/10] Add sxe2 driver liujie5
2026-05-06 2:12 ` [PATCH v6 01/10] mailmap: add Jie Liu liujie5
2026-05-06 2:12 ` [PATCH v6 02/10] doc: add sxe2 guide and release notes liujie5
2026-05-06 2:12 ` [PATCH v6 03/10] drivers: add sxe2 basic structures liujie5
2026-05-06 2:12 ` [PATCH v6 04/10] common/sxe2: add base driver skeleton liujie5
2026-05-06 2:12 ` [PATCH v6 05/10] drivers: add base driver probe skeleton liujie5
2026-05-06 2:12 ` [PATCH v6 06/10] drivers: support PCI BAR mapping liujie5
2026-05-06 2:12 ` [PATCH v6 07/10] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-06 2:12 ` [PATCH v6 08/10] net/sxe2: support queue setup and control liujie5
2026-05-06 2:12 ` [PATCH v6 09/10] drivers: add data path for Rx and Tx liujie5
2026-05-06 2:12 ` [PATCH v6 10/10] net/sxe2: add vectorized " liujie5
2026-05-06 3:31 ` [PATCH v7 00/10] Add Linkdata sxe2 driver liujie5
2026-05-06 3:31 ` [PATCH v7 01/10] doc: add sxe2 guide and release notes liujie5
2026-05-06 3:31 ` [PATCH v7 02/10] drivers: add sxe2 basic structures liujie5
2026-05-06 3:31 ` [PATCH v7 03/10] common/sxe2: add base driver skeleton liujie5
2026-05-06 3:31 ` [PATCH v7 04/10] drivers: add base driver probe skeleton liujie5
2026-05-06 3:31 ` [PATCH v7 05/10] drivers: support PCI BAR mapping liujie5
2026-05-06 3:31 ` [PATCH v7 06/10] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-06 3:31 ` [PATCH v7 07/10] net/sxe2: support queue setup and control liujie5
2026-05-06 3:31 ` [PATCH v7 08/10] drivers: add data path for Rx and Tx liujie5
2026-05-06 3:31 ` [PATCH v7 09/10] net/sxe2: add vectorized " liujie5
2026-05-06 6:12 ` [PATCH v8 00/10] Add Linkdata sxe2 driver liujie5
2026-05-06 6:12 ` [PATCH v8 01/10] mailmap: add Jie Liu liujie5
2026-05-06 6:12 ` [PATCH v8 02/10] doc: add sxe2 guide and release notes liujie5
2026-05-06 6:12 ` [PATCH v8 03/10] drivers: add sxe2 basic structures liujie5
2026-05-06 6:12 ` [PATCH v8 04/10] common/sxe2: add base driver skeleton liujie5
2026-05-06 6:12 ` [PATCH v8 05/10] drivers: add base driver probe skeleton liujie5
2026-05-06 6:12 ` [PATCH v8 06/10] drivers: support PCI BAR mapping liujie5
2026-05-06 6:12 ` [PATCH v8 07/10] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-06 6:12 ` [PATCH v8 08/10] net/sxe2: support queue setup and control liujie5
2026-05-06 6:12 ` [PATCH v8 09/10] drivers: add data path for Rx and Tx liujie5
2026-05-06 6:12 ` [PATCH v8 10/10] net/sxe2: add vectorized " liujie5
2026-05-06 9:56 ` [PATCH v9 00/10] Add Linkdata sxe2 driver liujie5
2026-05-06 9:56 ` [PATCH v9 01/10] mailmap: add Jie Liu liujie5
2026-05-06 9:56 ` [PATCH v9 02/10] doc: add sxe2 guide and release notes liujie5
2026-05-06 9:56 ` [PATCH v9 03/10] drivers: add sxe2 basic structures liujie5
2026-05-06 9:56 ` [PATCH v9 04/10] common/sxe2: add base driver skeleton liujie5
2026-05-06 9:56 ` [PATCH v9 05/10] drivers: add base driver probe skeleton liujie5
2026-05-06 9:56 ` [PATCH v9 06/10] drivers: support PCI BAR mapping liujie5
2026-05-06 9:56 ` [PATCH v9 07/10] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-06 9:57 ` [PATCH v9 08/10] net/sxe2: support queue setup and control liujie5
2026-05-06 9:57 ` [PATCH v9 09/10] drivers: add data path for Rx and Tx liujie5
2026-05-06 9:57 ` [PATCH v9 10/10] net/sxe2: add vectorized " liujie5
2026-05-06 11:35 ` [PATCH v10 00/10] Add Linkdata sxe2 driver liujie5
2026-05-06 11:35 ` [PATCH v10 01/10] mailmap: add Jie Liu liujie5
2026-05-06 11:35 ` [PATCH v10 02/10] doc: add sxe2 guide and release notes liujie5
2026-05-06 11:35 ` [PATCH v10 03/10] drivers: add sxe2 basic structures liujie5
2026-05-06 11:35 ` [PATCH v10 04/10] common/sxe2: add base driver skeleton liujie5
2026-05-06 11:35 ` [PATCH v10 05/10] drivers: add base driver probe skeleton liujie5
2026-05-06 11:35 ` [PATCH v10 06/10] drivers: support PCI BAR mapping liujie5
2026-05-06 11:35 ` [PATCH v10 07/10] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-06 11:35 ` [PATCH v10 08/10] net/sxe2: support queue setup and control liujie5
2026-05-06 11:35 ` [PATCH v10 09/10] drivers: add data path for Rx and Tx liujie5
2026-05-06 11:35 ` [PATCH v10 10/10] net/sxe2: add vectorized " liujie5
2026-05-07 1:44 ` [PATCH v11 0/9] Add Linkdata sxe2 driver liujie5
2026-05-07 1:44 ` [PATCH v11 1/9] mailmap: add Jie Liu liujie5
2026-05-07 1:44 ` [PATCH v11 2/9] doc: add sxe2 guide and release notes liujie5
2026-05-07 1:44 ` [PATCH v11 3/9] drivers: add sxe2 basic structures liujie5
2026-05-07 1:44 ` [PATCH v11 4/9] common/sxe2: add base driver skeleton liujie5
2026-05-07 1:44 ` [PATCH v11 5/9] drivers: add base driver probe skeleton liujie5
2026-05-07 1:44 ` [PATCH v11 6/9] drivers: support PCI BAR mapping liujie5
2026-05-07 1:44 ` [PATCH v11 7/9] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-07 1:44 ` [PATCH v11 8/9] net/sxe2: support queue setup and control liujie5
2026-05-07 1:44 ` [PATCH v11 9/9] drivers: add data path for Rx and Tx liujie5
2026-05-07 2:40 ` [PATCH v11 0/9] Add Linkdata sxe2 driver Stephen Hemminger
2026-05-12 8:06 ` [PATCH v12 00/10] net/sxe2: fix logic errors and address feedback liujie5
2026-05-12 8:06 ` [PATCH v12 01/10] mailmap: add Jie Liu liujie5
2026-05-12 8:06 ` [PATCH v12 02/10] doc: add sxe2 guide and release notes liujie5
2026-05-12 8:06 ` [PATCH v12 03/10] common/sxe2: add sxe2 basic structures liujie5
2026-05-12 8:06 ` [PATCH v12 04/10] drivers: add base driver skeleton liujie5
2026-05-12 8:06 ` [PATCH v12 05/10] drivers: add base driver probe skeleton liujie5
2026-05-12 8:06 ` [PATCH v12 06/10] drivers: support PCI BAR mapping liujie5
2026-05-12 8:06 ` [PATCH v12 07/10] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-12 8:06 ` [PATCH v12 08/10] net/sxe2: support queue setup and control liujie5
2026-05-12 8:06 ` [PATCH v12 09/10] drivers: add data path for Rx and Tx liujie5
2026-05-12 8:06 ` [PATCH v12 10/10] net/sxe2: add vectorized " liujie5
2026-05-12 11:36 ` [PATCH v13 00/10] net/sxe2: fix logic errors and address feedback liujie5
2026-05-12 11:36 ` [PATCH v13 01/10] mailmap: add Jie Liu liujie5
2026-05-12 11:36 ` [PATCH v13 02/10] doc: add sxe2 guide and release notes liujie5
2026-05-12 11:36 ` [PATCH v13 03/10] common/sxe2: add sxe2 basic structures liujie5
2026-05-12 11:36 ` [PATCH v13 04/10] drivers: add base driver skeleton liujie5
2026-05-12 11:36 ` [PATCH v13 05/10] drivers: add base driver probe skeleton liujie5
2026-05-12 11:36 ` [PATCH v13 06/10] drivers: support PCI BAR mapping liujie5
2026-05-12 11:36 ` [PATCH v13 07/10] common/sxe2: add ioctl interface for DMA map and unmap liujie5
2026-05-12 11:36 ` [PATCH v13 08/10] net/sxe2: support queue setup and control liujie5
2026-05-12 11:36 ` [PATCH v13 09/10] drivers: add data path for Rx and Tx liujie5
2026-05-12 11:36 ` [PATCH v13 10/10] net/sxe2: add vectorized " liujie5
2026-05-13 14:45 ` [PATCH v13 00/10] net/sxe2: fix logic errors and address feedback Stephen Hemminger
2026-05-07 0:23 ` [PATCH v10 00/10] Add Linkdata sxe2 driver Stephen Hemminger
2026-04-30 16:21 ` [PATCH v3 0/9] net/sxe2: added Linkdata sxe2 ethernet driver Stephen Hemminger
2026-04-30 17:02 ` Stephen Hemminger
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=20260430200514.0053998c@phoenix.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=liujie5@linkdatatechnology.com \
/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