Skip to content

V0/topic/nfsboot#1

Open
ejoerns wants to merge 1 commit intomasterfrom
v0/topic/nfsboot
Open

V0/topic/nfsboot#1
ejoerns wants to merge 1 commit intomasterfrom
v0/topic/nfsboot

Conversation

@ejoerns
Copy link
Owner

@ejoerns ejoerns commented Feb 24, 2016

No description provided.

If no valid boot source was found matching any of the known slot
entries, add a pseudo slot entry for nfs to the list of slots and set it
`booted`.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
@ejoerns ejoerns force-pushed the master branch 2 times, most recently from 3278046 to 78f7098 Compare September 21, 2021 06:06
ejoerns added a commit that referenced this pull request Nov 9, 2021
During manifest file parsing, we ensure that filename is set and allow
an unset filename only for an install hook.
Thus having filename unset after checking this conditition is a
programming error here. Check it with g_assert_nonnull().

Fixes coverity warning:

| CID 1465767 (#1 of 1): Dereference after null check (FORWARD_NULL)
| 20. var_deref_model: Passing null pointer mfimage->filename to g_file_test, which dereferences it.

Fixes 8a9c921 which added this check:

+               /* skip source image checks if filename is not set (install hook) */
+               if (!mfimage->filename && mfimage->hooks.install)
+                       goto skip_filename_checks;
+

that lets coverity assume we explicitly pass here in case of
mfimage->filename being null:

| 17. var_compare_op: Comparing mfimage->filename to null implies that mfimage->filename might be null.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Nov 9, 2021
During manifest file parsing, we ensure that filename is set and allow
an unset filename only for an install hook.
Thus having filename unset after checking this conditition is a
programming error here. Split the prior single condition into two and
check the unexpected case with g_assert_not_reached() to signal that reaching
this must be a programming error.

Fixes coverity warning:

| CID 1465767 (#1 of 1): Dereference after null check (FORWARD_NULL)
| 20. var_deref_model: Passing null pointer mfimage->filename to g_file_test, which dereferences it.

Fixes 8a9c921 which added this check:

+               /* skip source image checks if filename is not set (install hook) */
+               if (!mfimage->filename && mfimage->hooks.install)
+                       goto skip_filename_checks;
+

that lets coverity assume we explicitly pass here in case of
mfimage->filename being null:

| 17. var_compare_op: Comparing mfimage->filename to null implies that mfimage->filename might be null.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 1, 2022
The char pointer array 'groups' is freed manually with g_strfreev.
It is not freed in case of an error and a jump to the 'free:' label.

Fixes coverity issue:
| CID 1445510 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 17. leaked_storage: Variable groups going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 1, 2022
Fixes coverity issue:
| CID 1445506 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable raucm going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 1, 2022
The variable 'string' will not be freed on error.
Use g_autoptr to automatically free 'string' and use this to simplify
code.

Fixes coverity issue:
| CID 1445505 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable string going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 1, 2022
The binary data returned by r_hex_decode() is not freed. Fix it.

Fixes coverity issue:
| CID 1445503 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 23. leaked_storage: Variable root_digest going out of scope leaks the storage it points to.
ejoerns added a commit that referenced this pull request Mar 1, 2022
When jumping to free: label, g_strfreev() will not be called.
Use g_autoptr() instead.

Fixes coverity issue:
| CID 1445489 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 47. leaked_storage: Variable groups going out of scope leaks the storage it points to.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The char pointer array 'groups' is freed manually with g_strfreev.
It is not freed in case of an error and a jump to the 'free:' label.

Fixes coverity issue:
| CID 1445510 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 17. leaked_storage: Variable groups going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
Fixes coverity issue:
| CID 1445506 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable raucm going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The variable 'string' will not be freed on error.
Use g_autoptr to automatically free 'string' and use this to simplify
code.

Fixes coverity issue:
| CID 1445505 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable string going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The binary data returned by r_hex_decode() is not freed. Fix it.

Fixes coverity issue:
| CID 1445503 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 23. leaked_storage: Variable root_digest going out of scope leaks the storage it points to.
ejoerns added a commit that referenced this pull request Mar 2, 2022
When jumping to free: label, g_strfreev() will not be called.
Use g_autoptr() instead.

Fixes coverity issue:
| CID 1445489 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 47. leaked_storage: Variable groups going out of scope leaks the storage it points to.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The char pointer array 'groups' is freed manually with g_strfreev.
It is not freed in case of an error and a jump to the 'free:' label.

Fixes coverity issue:
| CID 1445510 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 17. leaked_storage: Variable groups going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
Fixes coverity issue:
| CID 1445506 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable raucm going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The variable 'string' will not be freed on error.
Use g_autoptr to automatically free 'string' and use this to simplify
code.

Fixes coverity issue:
| CID 1445505 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable string going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The binary data returned by r_hex_decode() is not freed. Fix it.

Fixes coverity issue:
| CID 1445503 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 23. leaked_storage: Variable root_digest going out of scope leaks the storage it points to.
ejoerns added a commit that referenced this pull request Mar 2, 2022
When jumping to free: label, g_strfreev() will not be called.
Use g_autoptr() instead.

Fixes coverity issue:
| CID 1445489 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 47. leaked_storage: Variable groups going out of scope leaks the storage it points to.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The char pointer array 'groups' is freed manually with g_strfreev.
It is not freed in case of an error and a jump to the 'free:' label.

Fixes coverity issue:
| CID 1445510 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 17. leaked_storage: Variable groups going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
Fixes coverity issue:
| CID 1445506 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable raucm going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The variable 'string' will not be freed on error.
Use g_autoptr to automatically free 'string' and use this to simplify
code.

Fixes coverity issue:
| CID 1445505 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable string going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The binary data returned by r_hex_decode() is not freed. Fix it.

Fixes coverity issue:
| CID 1445503 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 23. leaked_storage: Variable root_digest going out of scope leaks the storage it points to.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
When jumping to free: label, g_strfreev() will not be called.
Use g_autoptr() instead.

Fixes coverity issue:
| CID 1445489 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 47. leaked_storage: Variable groups going out of scope leaks the storage it points to.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
Fixes coverity issue:
| CID 1445506 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable raucm going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The variable 'string' will not be freed on error.
Use g_autoptr to automatically free 'string' and use this to simplify
code.

Fixes coverity issue:
| CID 1445505 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable string going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
The binary data returned by r_hex_decode() is not freed. Fix it.

Fixes coverity issue:
| CID 1445503 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 23. leaked_storage: Variable root_digest going out of scope leaks the storage it points to.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 2, 2022
When jumping to free: label, g_strfreev() will not be called.
Use g_autoptr() instead.

Fixes coverity issue:
| CID 1445489 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 47. leaked_storage: Variable groups going out of scope leaks the storage it points to.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 3, 2022
Fixes defect reported by coverity:
| CID 1475713 (#1 of 1): Unused value (UNUSED_VALUE)
| assigned_value: Assigning value 1.79769e+308 to stats->min here, but that stored value is overwritten before it can be used.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns added a commit that referenced this pull request Mar 17, 2022
Fixes defect reported by coverity:
| CID 1475713 (#1 of 1): Unused value (UNUSED_VALUE)
| assigned_value: Assigning value 1.79769e+308 to stats->min here, but that stored value is overwritten before it can be used.

This also fixes 'min' calculation as 'min' was already set to the
smalles possible value and thus could not be decreased.

Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
ejoerns pushed a commit that referenced this pull request Jan 28, 2025
This fixes an error leaking if error happen in r_nbd_run_server().

Fixes:

	==7101==ERROR: LeakSanitizer: detected memory leaks

	Direct leak of 16 byte(s) in 1 object(s) allocated from:
	    #0 0x7fb183cd0891 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
	    #1 0x7fb18379314a in g_malloc (/usr/lib/libglib-2.0.so.0+0x6314a) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    #2 0x7fb1837b2475 in g_slice_alloc0 (/usr/lib/libglib-2.0.so.0+0x82475) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    #3 0x7fb1837740a4  (/usr/lib/libglib-2.0.so.0+0x440a4) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    rauc#4 0x7fb183774835 in g_error_new_valist (/usr/lib/libglib-2.0.so.0+0x44835) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    rauc#5 0x7fb183774a81 in g_set_error (/usr/lib/libglib-2.0.so.0+0x44a81) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    rauc#6 0x55c569403615 in r_nbd_run_server ../src/nbd.c:943
	    rauc#7 0x55c569327de4 in main ../src/main.c:2984
	    rauc#8 0x7fb182a0ce07  (/usr/lib/libc.so.6+0x25e07) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
	    rauc#9 0x7fb182a0cecb in __libc_start_main (/usr/lib/libc.so.6+0x25ecb) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
	    rauc#10 0x55c5692eed14 in _start (/home/gportay/src/rauc/build/rauc+0x17ad14) (BuildId: fce67367819006bb3a0f97f5d3784a86063668bf)

	Indirect leak of 37 byte(s) in 1 object(s) allocated from:
	    #0 0x7fb183cd0891 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
	    #1 0x7fb182a6f438  (/usr/lib/libc.so.6+0x88438) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
	    #2 0x7fb1837e5143 in g_vasprintf (/usr/lib/libglib-2.0.so.0+0xb5143) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    #3 0x7fb1837b44d3 in g_strdup_vprintf (/usr/lib/libglib-2.0.so.0+0x844d3) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    rauc#4 0x7fb183774826 in g_error_new_valist (/usr/lib/libglib-2.0.so.0+0x44826) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    rauc#5 0x7fb183774a81 in g_set_error (/usr/lib/libglib-2.0.so.0+0x44a81) (BuildId: 443a4c4d7f48705038d59e3f6135a025298de9b9)
	    rauc#6 0x55c569403615 in r_nbd_run_server ../src/nbd.c:943
	    rauc#7 0x55c569327de4 in main ../src/main.c:2984
	    rauc#8 0x7fb182a0ce07  (/usr/lib/libc.so.6+0x25e07) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
	    rauc#9 0x7fb182a0cecb in __libc_start_main (/usr/lib/libc.so.6+0x25ecb) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
	    rauc#10 0x55c5692eed14 in _start (/home/gportay/src/rauc/build/rauc+0x17ad14) (BuildId: fce67367819006bb3a0f97f5d3784a86063668bf)

	SUMMARY: AddressSanitizer: 53 byte(s) leaked in 2 allocation(s).

Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
ejoerns added a commit that referenced this pull request Jun 19, 2025
With the change made in 705c9e5 ("src/update_handler: replace some
gotos by immediate return"), there are now paths that may leave
'part_slot' NULL (and it's also always dereferenced before).

Thus we can safely remove the check after the goto.

Fixes inconsistency reported by coverity:
| CID 1611650: (#1 of 1): Dereference before null check (REVERSE_INULL)
| check_after_deref: Null-checking part_slot suggests that it may be null, but it has already been dereferenced on all paths leading to the check

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
ejoerns pushed a commit that referenced this pull request Oct 15, 2025
The shell script save_gcov_data is unconditionally called after the
tests.

This script is generated in the temporary directory if GCOV_PREFIX is
set, and that variable is only set if the setfacl utility is installed
on the system.

If setfacl is not installed, qemu-test-init ends with an error because
the save_gcov_data script is not created:

	/home/gportay/src/rauc/qemu-test-init: 252: save_gcov_data: not found

This change ensures that save_gcov_data is only called when GCOV_PREFIX
is set, that is, under the same condition used to generate the script.

Fixes:

	+ save_gcov_data
	/home/gportay/src/rauc/qemu-test-init: 252: save_gcov_data: not found
	[   78.176805][    T1] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
	[   78.178272][    T1] CPU: 0 PID: 1 Comm: qemu-test-init Not tainted 6.6.36-rauc-test-gd8327fabb815 #1
	[   78.179862][    T1] Call Trace:
	[   78.180417][    T1]  <TASK>
	[   78.180920][    T1]  dump_stack_lvl+0x33/0x50
	[   78.181717][    T1]  panic+0x288/0x2d0
	[   78.182397][    T1]  do_exit+0x843/0x9b0
	[   78.183153][    T1]  ? handle_mm_fault+0x95/0x170
	[   78.184066][    T1]  do_group_exit+0x28/0x80
	[   78.184948][    T1]  __x64_sys_exit_group+0xf/0x10
	[   78.185996][    T1]  do_syscall_64+0x35/0x80
	[   78.186901][    T1]  entry_SYSCALL_64_after_hwframe+0x4b/0xb5
	[   78.188075][    T1] RIP: 0033:0x7fb19c5c921d
	[   78.188891][    T1] Code: 02 ba ff ff ff ff 89 d0 c3 0f 1f 40 00 f3 0f 1e fa 48 8b 35 ed 4b 11 00 ba e7 00 00 00 eb 07 66 0f 1f 44 00 00 f4 89 d0 0f 05 <48> 3d 00 f0 ff ff 76 f3 f7 d8 64 89 06 eb ec 0f 1f 40 00 f3 0f 1e
	[   78.192314][    T1] RSP: 002b:00007ffd52b7f538 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7
	[   78.193867][    T1] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fb19c5c921d
	[   78.194946][    T1] RDX: 00000000000000e7 RSI: ffffffffffffff88 RDI: 000000000000007f
	[   78.196119][    T1] RBP: 00007ffd52b7f610 R08: 00007ffd52b7f620 R09: 00007ffd52b7f680
	[   78.197363][    T1] R10: 000055f7720c9880 R11: 0000000000000202 R12: 0000000000000004
	[   78.198709][    T1] R13: 0000000000000000 R14: 000055f770a10dd8 R15: 00007fb19c73b000
	[   78.199959][    T1]  </TASK>
	[   78.200846][    T1] Kernel Offset: disabled
	[   78.201468][    T1] Rebooting in 1 seconds..

Signed-off-by: Gaël PORTAY <gael.portay@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments