If the first goto is taken, 'fd' is not opened yet (and is un-initialized).
So a direct return is safer.
Fixes: c1a31a2f7a9c ("cgroup: fix racy check in alloc_pagecache_max_30M() helper function")
Signed-off-by: Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
---
tools/testing/selftests/cgroup/test_memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c
index c3d0d5f7b19c..8833359556f3 100644
--- a/tools/testing/selftests/cgroup/test_memcontrol.c
+++ b/tools/testing/selftests/cgroup/test_memcontrol.c
@@ -448,7 +448,7 @@ static int alloc_pagecache_max_30M(const char *cgroup, void *arg)
high = cg_read_long(cgroup, "memory.high");
max = cg_read_long(cgroup, "memory.max");
if (high != MB(30) && max != MB(30))
- goto cleanup;
+ return -1;
fd = get_temp_fd();
if (fd < 0)
--
2.34.1
This fixes mis-applied changes from commit 72b1e03aa725 ("cgroup:
account for memory_localevents in test_memcg_oom_group_leaf_events()").
Signed-off-by: Michal Koutný <mkoutny(a)suse.com>
Reviewed-by: David Vernet <void(a)manifault.com>
Acked-by: Roman Gushchin <roman.gushchin(a)linux.dev>
---
.../selftests/cgroup/test_memcontrol.c | 25 +++++++++++--------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c
index 6ab94317c87b..c012db9d07d6 100644
--- a/tools/testing/selftests/cgroup/test_memcontrol.c
+++ b/tools/testing/selftests/cgroup/test_memcontrol.c
@@ -1241,7 +1241,16 @@ static int test_memcg_oom_group_leaf_events(const char *root)
if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0)
goto cleanup;
- if (cg_read_key_long(parent, "memory.events", "oom_kill ") <= 0)
+ parent_oom_events = cg_read_key_long(
+ parent, "memory.events", "oom_kill ");
+ /*
+ * If memory_localevents is not enabled (the default), the parent should
+ * count OOM events in its children groups. Otherwise, it should not
+ * have observed any events.
+ */
+ if (has_localevents && parent_oom_events != 0)
+ goto cleanup;
+ else if (!has_localevents && parent_oom_events <= 0)
goto cleanup;
ret = KSFT_PASS;
@@ -1349,20 +1358,14 @@ static int test_memcg_oom_group_score_events(const char *root)
if (!cg_run(memcg, alloc_anon, (void *)MB(100)))
goto cleanup;
- parent_oom_events = cg_read_key_long(
- parent, "memory.events", "oom_kill ");
- /*
- * If memory_localevents is not enabled (the default), the parent should
- * count OOM events in its children groups. Otherwise, it should not
- * have observed any events.
- */
- if ((has_localevents && parent_oom_events == 0) ||
- parent_oom_events > 0)
- ret = KSFT_PASS;
+ if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3)
+ goto cleanup;
if (kill(safe_pid, SIGKILL))
goto cleanup;
+ ret = KSFT_PASS;
+
cleanup:
if (memcg)
cg_destroy(memcg);
--
2.35.3
This series adds an Ultravisor(UV) device letting the userspace send some
Ultravisor calls to the UV. Currently two calls are supported.
Query Ultravisor Information (QUI) and
Receive Attestation Measurement (Attest[ation]).
The UV device is implemented as a miscdevice accepting only IOCTLs.
The IOCTL cmd specifies the UV call and the IOCTL arg the request
and response data depending on the UV call.
The device driver writes the UV response in the ioctl argument data.
The 'uvdevice' does no checks on the request beside faulty userspace
addresses, if sizes are in a sane range before allocating in kernel space,
and other tests that prevent the system from corruption.
Especially, no checks are made, that will be performed by the UV anyway
(E.g. 'invalid command' in case of attestation on unsupported hardware).
These errors are reported back to userspace using the UV return code
field.
The first patch introduces the new device as a module configured to be
compiled directly into the kernel (y) similar to the s390 SCLP and CHSH
miscdevice modules. The second atch introduces Kselftests which verify error
paths of the ioctl.
@Greg
There is now a userspace tool "pvattest" that uses the new device:
https://github.com/ibm-s390-linux/s390-tools/tree/for-2.22
We are currently discussing some nits regarding the processing
of certificates and the user interface and add the tool to
s390-tools/master afterwards.
However, the interface to the kernel is fixed.
The tool (pvattest) will be in s390-tools 2.22 that accompanies
linux 5.18.
You will be most interested in S390-tools/pvattest/src/uvio.{h,c}
and S390-tools/pvattest/src/pvattest.c
v3->v4:
* Dropped the QUI related patches, as we agreed that we do not want
to expose the QUI-UVC to userspace for now.
* Kconfig option was misplaced inside the S390 TAPE group ->fixed
* Some nits fixed:
* dropped the X from S390X in the uvdevice.h guard
* fixes kernel doc style issue in uvdevice.c
v2->v3:
The main change is that QUI is now introduced after Attestation as we
might not want pick it. Also the Kselftest patch is splitted into
Attestation and QUI so that they can be picked without requiring
QUI support of the uvdevice.
* dropped the Kconfig dependency
* reorganized the series:
- Patch 1 now covers the introduction of the uvdevice and Attestation
- Patch 2 adds QUI to uvdevice
- Patch 3/4 add Kselftests for Attestation and QUI
* fixed some nits
* added some comments
v1->v2:
* ioctl returns -ENOIOCTLCMD in case of a invalid ioctl command
* streamlined reserved field test
* default Kconfig is y instead of m
* improved selftest documentation
Steffen Eiden (2):
drivers/s390/char: Add Ultravisor io device
selftests: drivers/s390x: Add uvdevice tests
MAINTAINERS | 3 +
arch/s390/include/asm/uv.h | 23 +-
arch/s390/include/uapi/asm/uvdevice.h | 51 ++++
drivers/s390/char/Kconfig | 10 +
drivers/s390/char/Makefile | 1 +
drivers/s390/char/uvdevice.c | 264 +++++++++++++++++
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/drivers/.gitignore | 1 +
.../selftests/drivers/s390x/uvdevice/Makefile | 22 ++
.../selftests/drivers/s390x/uvdevice/config | 1 +
.../drivers/s390x/uvdevice/test_uvdevice.c | 276 ++++++++++++++++++
11 files changed, 652 insertions(+), 1 deletion(-)
create mode 100644 arch/s390/include/uapi/asm/uvdevice.h
create mode 100644 drivers/s390/char/uvdevice.c
create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/Makefile
create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/config
create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c
--
2.30.2
Hello,
This series add support for the renameat2 system call RENAME_EXCHANGE flag
(which allows to atomically replace two paths) to the vfat filesystem code.
There are many use cases for this, but we are particularly interested in
making possible for vfat filesystems to be part of OSTree [0] deployments.
Currently OSTree relies on symbolic links to make the deployment updates
an atomic transactional operation. But RENAME_EXCHANGE could be used [1]
to achieve a similar level of robustness when using a vfat filesystem.
Patch #1 is just a preparatory patch to introduce the RENAME_EXCHANGE
support in patch #2 and finally patch #3 adds some kselftests to test it.
This is my first contribution to the fs/* subsystem, so I'm marking this
set as RFC, in case I got anything wrong with the patches. But they work
correctly on my local testing.
[0]: https://github.com/ostreedev/ostree
[1]: https://github.com/ostreedev/ostree/issues/1649
Javier Martinez Canillas (3):
fat: add a vfat_rename2() and make existing .rename callback a helper
fat: add renameat2 RENAME_EXCHANGE flag support
selftests/filesystems: add a vfat RENAME_EXCHANGE test
MAINTAINERS | 1 +
fs/fat/namei_vfat.c | 172 +++++++++++++++++-
tools/testing/selftests/Makefile | 1 +
.../selftests/filesystems/fat/Makefile | 7 +
.../testing/selftests/filesystems/fat/config | 2 +
.../filesystems/fat/rename_exchange.c | 37 ++++
.../filesystems/fat/run_fat_tests.sh | 80 ++++++++
7 files changed, 293 insertions(+), 7 deletions(-)
create mode 100644 tools/testing/selftests/filesystems/fat/Makefile
create mode 100644 tools/testing/selftests/filesystems/fat/config
create mode 100644 tools/testing/selftests/filesystems/fat/rename_exchange.c
create mode 100755 tools/testing/selftests/filesystems/fat/run_fat_tests.sh
--
2.35.1
Spelling mistake (triple letters) in comment.
Detected with the help of Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall(a)inria.fr>
---
tools/testing/selftests/vm/protection_keys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
index 2d0ae88665db..291bc1e07842 100644
--- a/tools/testing/selftests/vm/protection_keys.c
+++ b/tools/testing/selftests/vm/protection_keys.c
@@ -1523,7 +1523,7 @@ void test_implicit_mprotect_exec_only_memory(int *ptr, u16 pkey)
/*
* Reset the shadow, assuming that the above mprotect()
* correctly changed PKRU, but to an unknown value since
- * the actual alllocated pkey is unknown.
+ * the actual allocated pkey is unknown.
*/
shadow_pkey_reg = __read_pkey_reg();