Dear Andrey, dear Nick, dear Greg, dear Sasha,
Compiling the kernel with UBSAN enabled and with gcc-8 and later fails when:
commit 1e1b6d63d634 ("lib/string.c: implement stpcpy") is applied, and
commit bac7a1fff792 ("lib/ubsan: remove returns-nonnull-attribute checks") is
not applied.
To reproduce, run:
tuxmake -r docker -a arm64 -t gcc-13 -k allnoconfig --kconfig-add
CONFIG_UBSAN=y
It then fails with:
aarch64-linux-gnu-ld: lib/string.o: in function `stpcpy':
string.c:(.text+0x694): undefined reference to
`__ubsan_handle_nonnull_return_v1'
string.c:(.text+0x694): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol
`__ubsan_handle_nonnull_return_v1'
Below you find a complete list of architectures, compiler versions and kernel
versions that I have tested with.
As commit bac7a1fff792 ("lib/ubsan: remove returns-nonnull-attribute checks") is
included in v4.16, and commit 1e1b6d63d634 ("lib/string.c: implement stpcpy") is
included in v5.9, this is not an issue that can happen on any mainline release
or the stable releases v4.19.y and later.
In the v4.14.y branch, however, commit 1e1b6d63d634 ("lib/string.c: implement
stpcpy") was included with v4.14.200 as commit b6d38137c19f and commit
bac7a1fff792 ("lib/ubsan: remove returns-nonnull-attribute checks") from
mainline was not included yet. Hence, this reported failure with UBSAN can be
observed on v4.14.y with recent gcc versions.
Greg, once checked and confirmed by Andrey or Nick, could you please include
commit bac7a1fff792 ("lib/ubsan: remove returns-nonnull-attribute checks") into
the linux-4.14.y branch?
The commit applies directly, without any change, on v4.14.200 to v4.14.325.
With that, future versions of v4.14.y will have a working UBSAN with the recent
gcc compiler versions.
Note: For any users, intending to run UBSAN on versions 4.14.200 to v4.14.325,
e.g., for bisecting UBSAN-detected kernel bugs on the linux-4.14.y branch, they
would simply need to apply commit bac7a1fff792 on those release versions.
Appendix of my full testing record:
For arm64 and x86-64 architecture, I tested this whole matrix of combinations of
building v4.14.200, i.e., the first version that failed with the reported build
failure and v4.14.325, i.e., the latest v4.14 release version at the time of
writing.
On v4.14.200 and on v4.14.325:
x86_64:
gcc-7: unsupported configuration (according to tuxmake)
gcc-8: affected and resolved by cherry-picking bac7a1fff792
gcc-9: affected and resolved by cherry-picking bac7a1fff792
gcc-10: affected and resolved by cherry-picking bac7a1fff792
gcc-11:
v4.14.200 fails with an unrelated build error on this compiler and arch
v4.14.325 affected and resolved by cherry-picking bac7a1fff792
gcc-12:
v4.14.200 fails with an unrelated build error on this compiler and arch
v4.14.325 affected and resolved by cherry-picking bac7a1fff792
gcc-13:
v4.14.200 fails with an unrelated build error on this compiler and arch
v4.14.325 affected and resolved by cherry-picking bac7a1fff792
clang-9: unsupported configuration (according to tuxmake)
clang-10: not affected, builds with and without cherry-picking bac7a1fff792
clang-17: not affected, builds with and without cherry-picking bac7a1fff792
arm64:
gcc-7: unsupported configuration (according to tuxmake)
gcc-8: affected and resolved by cherry-picking bac7a1fff792
gcc-9: affected and resolved by cherry-picking bac7a1fff792
gcc-10: affected and resolved by cherry-picking bac7a1fff792
gcc-11: affected and resolved by cherry-picking bac7a1fff792
gcc-12: affected and resolved by cherry-picking bac7a1fff792
gcc-13: affected and resolved by cherry-picking bac7a1fff792
clang-9: unsupported configuration (according to tuxmake)
clang-10: not affected, builds with and without cherry-picking bac7a1fff792
clang-17: not affected, builds with and without cherry-picking bac7a1fff792
Best regards,
Lukas
On 9/4/23 08:21, Denis Arefev wrote:
> The value of an arithmetic expression 1 << (cpu - sdp->mynode->grplo)
> is subject to overflow due to a failure to cast operands to a larger
> data type before performing arithmetic.
>
> The maximum result of this subtraction is defined by the RCU_FANOUT
> or other srcu level-spread values assigned by rcu_init_levelspread(),
> which can indeed cause the signed 32-bit integer literal ("1") to overflow
> when shifted by any value greater than 31.
We could expand on this:
The maximum result of this subtraction is defined by the RCU_FANOUT
or other srcu level-spread values assigned by rcu_init_levelspread(),
which can indeed cause the signed 32-bit integer literal ("1") to overflow
when shifted by any value greater than 31 on a 64-bit system.
Moreover, when the subtraction value is 31, the 1 << 31 expression results
in 0xffffffff80000000 when the signed integer is promoted to unsigned long
on 64-bit systems due to type promotion rules, which is certainly not the
intended result.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
With the commit message updated with my comment above, please also add:
Fixes: c7e88067c1 ("srcu: Exact tracking of srcu_data structures containing callbacks")
Cc: <stable(a)vger.kernel.org> # v4.11
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers(a)efficios.com>
Thanks!
Mathieu
>
> Signed-off-by: Denis Arefev <arefev(a)swemel.ru>
> ---
> v3: Changed the name of the patch, as suggested by
> Mathieu Desnoyers <mathieu.desnoyers(a)efficios.com>
> v2: Added fixes to the srcu_schedule_cbs_snp function as suggested by
> Mathieu Desnoyers <mathieu.desnoyers(a)efficios.com>
> kernel/rcu/srcutree.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index 20d7a238d675..6c18e6005ae1 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -223,7 +223,7 @@ static bool init_srcu_struct_nodes(struct srcu_struct *ssp, gfp_t gfp_flags)
> snp->grplo = cpu;
> snp->grphi = cpu;
> }
> - sdp->grpmask = 1 << (cpu - sdp->mynode->grplo);
> + sdp->grpmask = 1UL << (cpu - sdp->mynode->grplo);
> }
> smp_store_release(&ssp->srcu_sup->srcu_size_state, SRCU_SIZE_WAIT_BARRIER);
> return true;
> @@ -833,7 +833,7 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *ssp, struct srcu_node *snp
> int cpu;
>
> for (cpu = snp->grplo; cpu <= snp->grphi; cpu++) {
> - if (!(mask & (1 << (cpu - snp->grplo))))
> + if (!(mask & (1UL << (cpu - snp->grplo))))
> continue;
> srcu_schedule_cbs_sdp(per_cpu_ptr(ssp->sda, cpu), delay);
> }
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
Hi all,
Recently "memfd: improve userspace warnings for missing exec-related
flags" was merged. On my system, this is a regression, not an
improvement, because the entire 256k kernel log buffer (default on x86)
is filled with these warnings and "__do_sys_memfd_create: 122 callbacks
suppressed". I haven't investigated too closely, but the most likely
cause is Wayland libraries.
This is too serious of a consequence for using an old API, especially
considering how recently the flags were added. The vast majority of
software has not had time to add the flags: glibc does not define the
macros until 2.38 which was released less than one month ago, man-pages
does not document the flags, and according to Debian Code Search, only
systemd, stress-ng, and strace actually pass either of these flags.
Furthermore, since old kernels reject unknown flags, it's not just a
matter of defining and passing the flag; every program needs to
add logic to handle EINVAL and try again.
Some other way needs to be found to encourage userspace to add the
flags; otherwise, this message will be patched out because the kernel
log becomes unusable after running unupdated programs, which will still
exist even after upstreams are fixed. In particular, AppImages,
flatpaks, snaps, and similar app bundles contain vendored Wayland
libraries which can be difficult or impossible to update.
Thanks,
Alex.
From: Eric Biggers <ebiggers(a)google.com>
Since commit d7e7b9af104c ("fscrypt: stop using keyrings subsystem for
fscrypt_master_key"), xfstest generic/270 causes a WARNING when run on
f2fs with test_dummy_encryption in the mount options:
$ kvm-xfstests -c f2fs/encrypt generic/270
[...]
WARNING: CPU: 1 PID: 2453 at fs/crypto/keyring.c:240 fscrypt_destroy_keyring+0x1f5/0x260
The cause of the WARNING is that not all encrypted inodes have been
evicted before fscrypt_destroy_keyring() is called, which violates an
assumption. This happens because the test uses an external quota file,
which gets automatically encrypted due to test_dummy_encryption.
Encryption of quota files has never really been supported. On ext4,
ext4_quota_read() does not decrypt the data, so encrypted quota files
are always considered invalid on ext4. On f2fs, f2fs_quota_read() uses
the pagecache, so trying to use an encrypted quota file gets farther,
resulting in the issue described above being possible. But this was
never intended to be possible, and there is no use case for it.
Therefore, make the quota support layer explicitly reject using
IS_ENCRYPTED inodes when quotaon is attempted.
Cc: stable(a)vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers(a)google.com>
---
fs/quota/dquot.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 9e72bfe8bbad9..7e268cd2727cc 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2339,6 +2339,20 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)
if (sb_has_quota_loaded(sb, type))
return -EBUSY;
+ /*
+ * Quota files should never be encrypted. They should be thought of as
+ * filesystem metadata, not user data. New-style internal quota files
+ * cannot be encrypted by users anyway, but old-style external quota
+ * files could potentially be incorrectly created in an encrypted
+ * directory, hence this explicit check. Some reasons why encrypted
+ * quota files don't work include: (1) some filesystems that support
+ * encryption don't handle it in their quota_read and quota_write, and
+ * (2) cleaning up encrypted quota files at unmount would need special
+ * consideration, as quota files are cleaned up later than user files.
+ */
+ if (IS_ENCRYPTED(inode))
+ return -EINVAL;
+
dqopt->files[type] = igrab(inode);
if (!dqopt->files[type])
return -EIO;
base-commit: 708283abf896dd4853e673cc8cba70acaf9bf4ea
--
2.42.0
Sehr geehrter E-Mail-Besitzer,
Der Internationale Währungsfonds (IWF) entschädigt alle Betrugsopfer
und Ihre E-Mail-Adresse wurde auf der Liste der Betrugsopfer gefunden.
Dieses Western Union-Büro wurde vom IWF beauftragt Ihnen Ihre
Vergütung per Western Union Money Transfer zu überweisen.
Wir haben uns jedoch entschieden Ihre eigene Zahlung über Geldtransfer
der Westunion in Höhe von €5,000, pro Tag vorzunehmen bis die
Gesamtsumme von €1,500.000.00, vollständig an Sie überwiesen wurde.
Wir können die Zahlung möglicherweise nicht nur mit Ihrer
E-Mail-Adresse senden daher benötigen wir Ihre Informationen darüber
wohin wir das Geld an Sie senden wie z. B.:
Name des Adressaten ________________
Adresse________________
Land__________________
Telefonnummer________________
Angehängte Kopie Ihres Ausweises______________
Das Alter ________________________
Wir beginnen mit der Übertragung sobald wir Ihre Informationen
erhalten haben: Kontakt E-Mail: ( wuwumoneytransfer5000(a)hotmail.com)
Getreu,
Herr Anthony Duru,
Direktor von Geldtransfer der Westunion
Dobré ráno,
máte možnost sledovat stav každého stroje a výrobního procesu z kanceláře, konferenční místnosti nebo dokonce z domova či na cestách – na vašem telefonu?
Poskytujeme rychle implementovatelný a snadno použitelný nástroj, který zachytí i několikasekundový mikroprostoj a okamžitě přepočítá využití stroje v kontextu dané výrobní zakázky.
Kdykoli vidíte stav objednávky a jste informováni o případném snížení efektivity. Systém sám analyzuje data a připravuje cenné reporty, což operátorům umožňuje soustředit se na výrobní cíl.
Cíl je jednoduchý: jeden pohled – celá továrna. Čekám na odpověď, jestli vidíte možnost využití takového nástroje ve vaší firmě.
Pozdravy
Michal Rmoutil