All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <martin.wilck@suse.com>
To: Benjamin Marzinski <bmarzins@redhat.com>, dm-devel@lists.linux.dev
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Subject: [PATCH 9/9] multipath-tools: compile with -fno-strict-aliasing
Date: Fri,  9 Jan 2026 19:39:07 +0100	[thread overview]
Message-ID: <20260109183907.201250-10-mwilck@suse.com> (raw)
In-Reply-To: <20260109183907.201250-1-mwilck@suse.com>

multipath-tools uses container_of() and similar macros, which imply
casts between different types, which isn't stricly compliant with
strict aliasing rules. The issue that lead to the previous commit
"libmpathutil: use union for bitfield" was one example where this
can fail. While that one could be fixed relatively easily, it shows
that surprises can happen any time when we compile our code with
strict aliasing enabled. This can be seen clearly when we compile
with "-fstrict-aliasing -Wstrict-aliasing=1" (note that the bitfield
problem is only reported by gcc with "-Wstrict-aliasing=1", other
levels of aliasing detection miss it with gcc 15).

Use -fno-strict-aliasing to disable it. The kernel does the same.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index 3dbcdcf..539415d 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -122,7 +122,7 @@ CPPFLAGS	:= $(FORTIFY_OPT) $(CPPFLAGS) $(D_URCU_VERSION) $(D_CMOCKA_VERSION) \
 		   -DWSTRINGOP_TRUNCATION=$(if $(WSTRINGOP_TRUNCATION),1,0) \
 		   -MMD -MP
 CFLAGS		:= -std=$(C_STD) $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
-		   -fexceptions
+		   -fexceptions -fno-strict-aliasing
 BIN_CFLAGS	:= -fPIE -DPIE
 LIB_CFLAGS	:= -fPIC
 SHARED_FLAGS	:= -shared
-- 
2.52.0


  parent reply	other threads:[~2026-01-09 18:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 18:38 [PATCH 0/9] multipath-tools: more small fixes Martin Wilck
2026-01-09 18:38 ` [PATCH 1/9] libmultipath: reset pgindex in uninitialize_path() Martin Wilck
2026-01-09 18:39 ` [PATCH 2/9] libmultipath: clarify code in set_path_removed() Martin Wilck
2026-01-09 18:39 ` [PATCH 3/9] libmultipath: nullify pp->mpp before calling free_path() Martin Wilck
2026-01-09 18:39 ` [PATCH 4/9] libmultipath: log error when freeing path that refers to a map Martin Wilck
2026-01-09 18:39 ` [PATCH 5/9] libmultipath: sync_paths(): print message when fixing pp->mpp Martin Wilck
2026-01-09 18:39 ` [PATCH 6/9] libmultipath: don't free mpp->paths in group_paths() Martin Wilck
2026-01-09 18:39 ` [PATCH 7/9] libmultipath: warn only once in scsi_tmo_error_msg() Martin Wilck
2026-01-09 18:39 ` [PATCH 8/9] libmultipath: find_hwe(): fix gcc errors at high optimization levels Martin Wilck
2026-01-09 18:39 ` Martin Wilck [this message]
2026-01-13 20:56 ` [PATCH 0/9] multipath-tools: more small fixes Benjamin Marzinski

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=20260109183907.201250-10-mwilck@suse.com \
    --to=martin.wilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.