lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 5 Nov 2021 10:49:54 +0100
From:   Petr Vorel <pvorel@...e.cz>
To:     Gabriel Krisman Bertazi <krisman@...labora.com>
Cc:     jack@...e.com, amir73il@...il.com, repnop@...gle.com,
        linux-ext4@...r.kernel.org, kernel@...labora.com,
        khazhy@...gle.com, ltp@...ts.linux.it
Subject: Re: [LTP] [PATCH v3 5/9] syscalls/fanotify21: Validate incoming FID
 in FAN_FS_ERROR

Hi all,

Reviewed-by: Petr Vorel <pvorel@...e.cz>

...
> +int check_error_event_info_fid(struct fanotify_event_info_fid *fid,
> +				 const struct test_case *ex)
> +{
> +	struct file_handle *fh = (struct file_handle *) &fid->handle;
> +
> +	if (memcmp(&fid->fsid, &ex->fid->fsid, sizeof(fid->fsid))) {
> +		tst_res(TFAIL, "%s: Received bad FSID type (%x...!=%x...)",
> +			ex->name, FSID_VAL_MEMBER(fid->fsid, 0),
> +			FSID_VAL_MEMBER(ex->fid->fsid, 0));
Correct way is (I'll fix it before pushing this PR):

	if (memcmp(&fid->fsid, &ex->fid->fsid, sizeof(fid->fsid))) {
		tst_res(TFAIL, "%s: Received bad FSID type (%x...!=%x...)",
			ex->name, FSID_VAL_MEMBER(fid->fsid, 0),
			ex->fid->fsid.val[0]);

Using FSID_VAL_MEMBER() is invalid, it broke compilation for musl.
FSID_VAL_MEMBER was created to fix musl compilations, but it should be used only
for struct fanotify_event_info_fid, using it for struct event_t (which has also
__kernel_fsid_t fsid) is invalid and causes this error:

In file included from fanotify21.c:35:
fanotify21.c: In function 'check_error_event_info_fid':
fanotify.h:200:41: error: 'lapi_fsid_t' has no member named '__val'; did you mean 'val'?
  200 | # define FSID_VAL_MEMBER(fsid, i) (fsid.__val[i])
      |                                         ^~~~~
../../../../include/tst_test.h:58:54: note: in expansion of macro 'FSID_VAL_MEMBER'
   58 |   tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\
      |                                                      ^~~~~~~~~~~
fanotify21.c:132:3: note: in expansion of macro 'tst_res'
  132 |   tst_res(TFAIL, "%s: Received bad FSID type (%x...!=%x...)",
      |   ^~~~~~~
make: *** [../../../../include/mk/rules.mk:37: fanotify21] Error 1

Sorry for confusion, not sure how to improve FSID_VAL_MEMBER() to avoid these
errors.

See f37704d6c ("fanotify: Fix FSID_VAL_MEMBER() usage")

Kind regards,
Petr

Powered by blists - more mailing lists