hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAEOV4
CVE: NA
--------------------------------
When thp_exec_enabled is set to 3, try PMD mapping THP first, if
failed, then try mTHP like cont-64K on ARM64.
The previous implementaion use hugepage_madvise() in
try_enable_file_exec_thp and it will always set
vm_flags |= VM_HUGEPAGE so we lost this semantic.
Replace it as thp_vma_allowable_order(,,,PMD_ORDER) to implement
the right semantic.
And now the khugepaged_enter_vma() step in hugepage_madvise() is
missing, this is OK because the process is already entered in
khugepaged after this commit 613bec092fe7 ("mm: mmap: register
suitable readonly file vmas for khugepaged")
Signed-off-by: Nanyong Sun <sunnanyong(a)huawei.com>
---
mm/filemap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index d3c813429bf2..4dd8fe6ffa05 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3159,8 +3159,12 @@ static inline void try_enable_file_exec_thp(struct vm_area_struct *vma,
if (file->f_op->get_unmapped_area != thp_get_unmapped_area)
return;
- if (file_exec_thp_enabled())
- hugepage_madvise(vma, vm_flags, MADV_HUGEPAGE);
+ if (!file_exec_thp_enabled())
+ return;
+
+ if (thp_vma_allowable_order(vma, *vm_flags, TVA_ENFORCE_SYSFS,
+ PMD_ORDER))
+ *vm_flags |= VM_HUGEPAGE;
}
static inline bool file_exec_can_enable_mthp(struct address_space *mapping,
--
2.25.1
From: Rand Deeb <rand.sec96(a)gmail.com>
mainline inclusion
from mainline-v6.10-rc1
commit 789c17185fb0f39560496c2beab9b57ce1d0cbe7
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAD028
CVE: CVE-2024-40982
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
The ssb_device_uevent() function first attempts to convert the 'dev' pointer
to 'struct ssb_device *'. However, it mistakenly dereferences 'dev' before
performing the NULL check, potentially leading to a NULL pointer
dereference if 'dev' is NULL.
To fix this issue, move the NULL check before dereferencing the 'dev' pointer,
ensuring that the pointer is valid before attempting to use it.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Rand Deeb <rand.sec96(a)gmail.com>
Signed-off-by: Kalle Valo <kvalo(a)kernel.org>
Link: https://msgid.link/20240306123028.164155-1-rand.sec96@gmail.com
---
drivers/ssb/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index ab080cf26c9f..0c736d51566d 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -341,11 +341,13 @@ static int ssb_bus_match(struct device *dev, struct device_driver *drv)
static int ssb_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
- const struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
+ const struct ssb_device *ssb_dev;
if (!dev)
return -ENODEV;
+ ssb_dev = dev_to_ssb_dev(dev);
+
return add_uevent_var(env,
"MODALIAS=ssb:v%04Xid%04Xrev%02X",
ssb_dev->id.vendor, ssb_dev->id.coreid,
--
2.33.0
mainline inclusion
from mainline-v6.10-rc1
commit 789c17185fb0f39560496c2beab9b57ce1d0cbe7
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAD028
CVE: CVE-2024-40982
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
The ssb_device_uevent() function first attempts to convert the 'dev' pointer
to 'struct ssb_device *'. However, it mistakenly dereferences 'dev' before
performing the NULL check, potentially leading to a NULL pointer
dereference if 'dev' is NULL.
To fix this issue, move the NULL check before dereferencing the 'dev' pointer,
ensuring that the pointer is valid before attempting to use it.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Rand Deeb <rand.sec96(a)gmail.com>
Signed-off-by: Kalle Valo <kvalo(a)kernel.org>
Link: https://msgid.link/20240306123028.164155-1-rand.sec96@gmail.com
Signed-off-by: Yu Liao <liaoyu15(a)huawei.com>
---
drivers/ssb/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 0a26984acb2c..1b4ce17998c0 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -340,11 +340,13 @@ static int ssb_bus_match(struct device *dev, struct device_driver *drv)
static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
- struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
+ struct ssb_device *ssb_dev;
if (!dev)
return -ENODEV;
+ ssb_dev = dev_to_ssb_dev(dev);
+
return add_uevent_var(env,
"MODALIAS=ssb:v%04Xid%04Xrev%02X",
ssb_dev->id.vendor, ssb_dev->id.coreid,
--
2.33.0
mainline inclusion
from mainline-v6.10-rc1
commit 789c17185fb0f39560496c2beab9b57ce1d0cbe7
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAD028
CVE: CVE-2024-40982
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
The ssb_device_uevent() function first attempts to convert the 'dev' pointer
to 'struct ssb_device *'. However, it mistakenly dereferences 'dev' before
performing the NULL check, potentially leading to a NULL pointer
dereference if 'dev' is NULL.
To fix this issue, move the NULL check before dereferencing the 'dev' pointer,
ensuring that the pointer is valid before attempting to use it.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Rand Deeb <rand.sec96(a)gmail.com>
Signed-off-by: Kalle Valo <kvalo(a)kernel.org>
Link: https://msgid.link/20240306123028.164155-1-rand.sec96@gmail.com
Signed-off-by: Yu Liao <liaoyu15(a)huawei.com>
---
drivers/ssb/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 0a26984acb2c..1b4ce17998c0 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -340,11 +340,13 @@ static int ssb_bus_match(struct device *dev, struct device_driver *drv)
static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
- struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
+ struct ssb_device *ssb_dev;
if (!dev)
return -ENODEV;
+ ssb_dev = dev_to_ssb_dev(dev);
+
return add_uevent_var(env,
"MODALIAS=ssb:v%04Xid%04Xrev%02X",
ssb_dev->id.vendor, ssb_dev->id.coreid,
--
2.33.0
From: NeilBrown <neilb(a)suse.de>
mainline inclusion
from mainline-v5.17-rc4
commit b49ea673e119f59c71645e2f65b3ccad857c90ee
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IADG5L
CVE: CVE-2022-48816
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
---------------------------
->sock can be set to NULL asynchronously unless ->recv_mutex is held.
So it is important to hold that mutex. Otherwise a sysfs read can
trigger an oops.
Commit 17f09d3f619a ("SUNRPC: Check if the xprt is connected before
handling sysfs reads") appears to attempt to fix this problem, but it
only narrows the race window.
Fixes: 17f09d3f619a ("SUNRPC: Check if the xprt is connected before handling sysfs reads")
Fixes: a8482488a7d6 ("SUNRPC query transport's source port")
Signed-off-by: NeilBrown <neilb(a)suse.de>
Signed-off-by: Anna Schumaker <Anna.Schumaker(a)Netapp.com>
Conflicts:
net/sunrpc/sysfs.c
[Did not backport e44773daf851d.]
Signed-off-by: Liu Jian <liujian56(a)huawei.com>
---
net/sunrpc/xprtsock.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 0666f981618a..8d9a27b25ca5 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1676,7 +1676,12 @@ static int xs_get_srcport(struct sock_xprt *transport)
unsigned short get_srcport(struct rpc_xprt *xprt)
{
struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt);
- return xs_sock_getport(sock->sock);
+ unsigned short ret = 0;
+ mutex_lock(&sock->recv_mutex);
+ if (sock->sock)
+ ret = xs_sock_getport(sock->sock);
+ mutex_unlock(&sock->recv_mutex);
+ return ret;
}
EXPORT_SYMBOL(get_srcport);
--
2.34.1
From: NeilBrown <neilb(a)suse.de>
mainline inclusion
from mainline-v5.17-rc4
commit b49ea673e119f59c71645e2f65b3ccad857c90ee
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IADG5L
CVE: CVE-2022-48816
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
---------------------------
->sock can be set to NULL asynchronously unless ->recv_mutex is held.
So it is important to hold that mutex. Otherwise a sysfs read can
trigger an oops.
Commit 17f09d3f619a ("SUNRPC: Check if the xprt is connected before
handling sysfs reads") appears to attempt to fix this problem, but it
only narrows the race window.
Fixes: 17f09d3f619a ("SUNRPC: Check if the xprt is connected before handling sysfs reads")
Fixes: a8482488a7d6 ("SUNRPC query transport's source port")
Signed-off-by: NeilBrown <neilb(a)suse.de>
Signed-off-by: Anna Schumaker <Anna.Schumaker(a)Netapp.com>
Conflicts:
net/sunrpc/sysfs.c
[Did not backport e44773daf851d.]
Signed-off-by: Liu Jian <liujian56(a)huawei.com>
---
net/sunrpc/xprtsock.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 0666f981618a..8d9a27b25ca5 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1676,7 +1676,12 @@ static int xs_get_srcport(struct sock_xprt *transport)
unsigned short get_srcport(struct rpc_xprt *xprt)
{
struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt);
- return xs_sock_getport(sock->sock);
+ unsigned short ret = 0;
+ mutex_lock(&sock->recv_mutex);
+ if (sock->sock)
+ ret = xs_sock_getport(sock->sock);
+ mutex_unlock(&sock->recv_mutex);
+ return ret;
}
EXPORT_SYMBOL(get_srcport);
--
2.34.1