-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homectl: make sure we sent the full 8 bytes as flags #31420
Conversation
Otherwise weird stuff happens on the other side: [1217111.957263] testsuite-46.sh[61]: + homectl create test-user --disk-size=min --luks-discard=yes --image-path=/home/test-user.home --luks-pbkdf-type=pbkdf2 --luks-pbkdf-time-cost=1ms [1217112.598219] homectl[66]: Operation on home test-user failed: Provided flags are unsupported (0ad2578000000000). (taken from TEST-46-HOME run on armv7l) Fixes issue mentioned in systemd#31419 (comment).
d97f546
to
460cc18
Compare
Wait, what? We have tons of flags parameters, does that mean most of those are sending broken messages? |
If there's a |
Shouldn't the library cast any 't' input automatically then, rather than having every caller do it? |
When we see |
Yup, as Adrian says, this is an unfortunate (mis?) feature of the va_arg stuff. For example, with this reproducer: #include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
void vaarg_fun(const char *types, ...) {
va_list ap;
va_start(ap, types);
printf("0x%llx\n", va_arg(ap, uint64_t));
va_end(ap);
}
int main(void) {
vaarg_fun("t", 0);
vaarg_fun("t", UINT64_C(0));
vaarg_fun("t", 1);
vaarg_fun("t", UINT64_C(1));
return 0;
} I get this output on x86_64:
But on armv7l I get this:
Maybe I should, at least, write a Coccinelle rule, that would catch these cases somewhat automagically. |
…essage fields Since we use varargs for sd_message_append() we need to make sure the parameters we pass are actually 64bit wide, if "t" is used. Hence cast appropriately if necessary. I went through the whole tree, and in most cases we got it right, but there are some cases we missed so far. Inspired by: systemd#31420
also see → #31427 |
That would be very nice, because this is not at all obvious otherwise |
…essage fields Since we use varargs for sd_message_append() we need to make sure the parameters we pass are actually 64bit wide, if "t" is used. Hence cast appropriately if necessary. I went through the whole tree, and in most cases we got it right, but there are some cases we missed so far. Inspired by: #31420
…essage fields Since we use varargs for sd_message_append() we need to make sure the parameters we pass are actually 64bit wide, if "t" is used. Hence cast appropriately if necessary. I went through the whole tree, and in most cases we got it right, but there are some cases we missed so far. Inspired by: systemd#31420
…essage fields Since we use varargs for sd_message_append() we need to make sure the parameters we pass are actually 64bit wide, if "t" is used. Hence cast appropriately if necessary. I went through the whole tree, and in most cases we got it right, but there are some cases we missed so far. Inspired by: systemd#31420 (cherry picked from commit 04a3af3)
…essage fields Since we use varargs for sd_message_append() we need to make sure the parameters we pass are actually 64bit wide, if "t" is used. Hence cast appropriately if necessary. I went through the whole tree, and in most cases we got it right, but there are some cases we missed so far. Inspired by: systemd#31420
…essage fields Since we use varargs for sd_message_append() we need to make sure the parameters we pass are actually 64bit wide, if "t" is used. Hence cast appropriately if necessary. I went through the whole tree, and in most cases we got it right, but there are some cases we missed so far. Inspired by: systemd#31420 (cherry picked from commit 04a3af3) (cherry picked from commit c0f501c)
…essage fields Since we use varargs for sd_message_append() we need to make sure the parameters we pass are actually 64bit wide, if "t" is used. Hence cast appropriately if necessary. I went through the whole tree, and in most cases we got it right, but there are some cases we missed so far. Inspired by: systemd#31420 (cherry picked from commit 04a3af3) (cherry picked from commit c0f501c) (cherry picked from commit 72b9369)
Otherwise weird stuff happens on the other side:
(taken from TEST-46-HOME run on armv7l)
Fixes issue mentioned in #31419 (comment).