Open nathanchance opened 3 years ago
Any idea which architectures this happens on? There are two possible ways we might get around this:
a) a lot of architectures do not support I/O port accesses at all and should not define these as pointer dereferences in the first place
b) using a NULL pointer as the I/O port base is generally a bad idea as well, as it leads to a misplaced port number causing random data corruption, and they should define a proper base in virtual memory
@arndb I can for sure see this for s390. I have seen certain instances where riscv and powerpc generate warnings such as these but it looks like from files other than include/asm-generic/io.h
.
s390 does not have any support for I/O ports, and just returns NULL from ioport_map(), while ignoring any IORESOURCE_IO BARs on a PCI device, so in that case, we could put anything in there. I would suggest adding a stub function that contains a WARN_ON(1) and just returns all-ones.
Hmmm I am not sure I understand the suggestion. All of these warnings are in the IO access functions, which are used even when ioport_map
returns NULL, right?
The point is that actually calling any of these functions on s390 will result in undefined behavior because it actually does a NULL pointer dereference. What I would suggest doing instead is to rewrite the I/O port accessors to either get hidden, or to replace them with a function that does a WARN_ONCE() but does not try to pass the pointer into readl/writel
@arndb do you have cycles to rereview v6 above?
I can see these in -next as: a5f7166b58cda2430123eb9bb96d60340e699ae4 78924148a3d22e030fe8f5c1a0ce10e177856423 5ae6eadfdaf431f47adbdf1754f3b5a5fd638de2 with @arndb 's SOB, though I'm not sure which tree this is flowing into -next via.
Niklas's solution was rejected at pull time: https://lore.kernel.org/r/CAK8P3a2oZ-+qd3Nhpy9VVXCJB3DU5N-y-ta2JpP0t6NHh=GVXw@mail.gmail.com/
This now affects Hexagon after commits 81c0386c1376 ("regmap: mmio: Support accelerared noinc operations") and f8f60615379c ("regmap/hexagon: Properly fix the generic IO helpers") :/
https://builds.tuxbuild.com/2DlDBj7YHaFv8PfY24gTGrHwKmq/build.log
I think this is the latest series for this: https://lore.kernel.org/all/20230522105049.1467313-1-schnelle@linux.ibm.com/
fs/btrfs
has enabled W=1 for themselves (commit), which results in 1000+ warnings on architectures wherePCI_IOBASE
is not defined (as it evaluates to a NULL pointer). Example:Full build log: https://builds.tuxbuild.com/1niBayWPViIGDJ1NJeZ2RJH0siz/build.log
Really ugly fix:
cc @arndb as I know you have fixed some of these in the past.