Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2678205pxb; Fri, 5 Nov 2021 02:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9ErD/GHIak1kaKOnhkm+8CwcDrqZFF5Kb2UhCxWhsQkgLlf3xlMD2UQHmRAyxHM0EM6qm X-Received: by 2002:a17:907:3f07:: with SMTP id hq7mr58184113ejc.420.1636105839045; Fri, 05 Nov 2021 02:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636105839; cv=none; d=google.com; s=arc-20160816; b=053Dmp6UbGX/teT1/ku/e9pfoVnOUOkX7x4qZb0aMkR6P5N6057LLr6l9dBBQDNVwh nG7fkbWWP+AHsvU/p/b5zQhPQ6lAN8RBh4KuEgX8AdoY/U64ZGytIoQgvrWSwgzuZ+b+ nBl1RuELsULud5dOJLTGet9iLfTl86Rd7QoHKHf7aa4g8mXhcpCyvOXTJF3EZVkoS7nN Cbv/e44VEGlMrx9ntt0ia4fMqE5h0VjZAp0DjD9qnPaRRBr4uHukft5NgW38iAoMDTbV UDYBfK51fcT8/7GCciTouDl5PeR+NYTwhv7oCpQmkTPOsSrKKfH2Aqqkwf/jo3ll/MY/ 7IIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=RRWMMk17DEUJ38plRlKGaMqVFwoarVGmkRNCrKvlLlE=; b=ysHHPZHA6cU1gJ4jCOrCRiZYh8rc0X39OqQAQrGN3XNYTCZPtJpNJMsZkidYq/2NKx 6Nfpt3YlFziRKB2/5l0pgWXkQpikUn4Hx9eIvHiK3njJgd+Hbxq67kjEgDyHT18BwHHO JH7QzeQw8/8x0jYY+7DhxXXSUJGVivoU/LxUMryuYA6e0Di5+kKK7IusrWS7NAkHfl0t EJKhCYV4yY+bNGg6OfHrkxOfLidXcC755D/qFHk/pXOOCv6d3i+TnZpMdNPW9muvu1np aOhS23XVh/gvXytzo48NSxujUhI94vfu5bfiRsZQyYZcz++Ywyr/P5lXOhYXoiwn8oXX hIUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=EHIGftrM; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=BaNhKzDq; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h22si14063197edr.521.2021.11.05.02.50.07; Fri, 05 Nov 2021 02:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=EHIGftrM; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=BaNhKzDq; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbhKEJwg (ORCPT + 99 others); Fri, 5 Nov 2021 05:52:36 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:50808 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbhKEJwg (ORCPT ); Fri, 5 Nov 2021 05:52:36 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 219EC1FD36; Fri, 5 Nov 2021 09:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1636105796; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RRWMMk17DEUJ38plRlKGaMqVFwoarVGmkRNCrKvlLlE=; b=EHIGftrMPkFRrjr+SuZB9O8gmgYFpzR0uil99nJMC6+7+SUAOshCPnFZQK7DndFf6mfnru n9jElJVP1FFj/bdxXKGGHyVsbutZh3ynaVBF2ZjsEx69Ct/nZ1azumbQbGq1pOIpzomet3 l9x3UKBzrRBaCWVEoMVbXHF3IoGoxQE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1636105796; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RRWMMk17DEUJ38plRlKGaMqVFwoarVGmkRNCrKvlLlE=; b=BaNhKzDqtgydvv/EjFreSV71xfA0X0pxAeTvO9F0SvNqZiOP49yuS8M9fNDpI+tht+NaNt bakhs2yq8LSa7HBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C0B5413B97; Fri, 5 Nov 2021 09:49:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2UjXLEP+hGHtcAAAMHmgww (envelope-from ); Fri, 05 Nov 2021 09:49:55 +0000 Date: Fri, 5 Nov 2021 10:49:54 +0100 From: Petr Vorel To: Gabriel Krisman Bertazi Cc: jack@suse.com, amir73il@gmail.com, repnop@google.com, linux-ext4@vger.kernel.org, kernel@collabora.com, khazhy@google.com, ltp@lists.linux.it Subject: Re: [LTP] [PATCH v3 5/9] syscalls/fanotify21: Validate incoming FID in FAN_FS_ERROR Message-ID: Reply-To: Petr Vorel References: <20211029211732.386127-1-krisman@collabora.com> <20211029211732.386127-6-krisman@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211029211732.386127-6-krisman@collabora.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi all, Reviewed-by: Petr Vorel ... > +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