From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCAF428F1 for ; Wed, 10 Aug 2022 14:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660141742; x=1691677742; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=JLXzoyOvEjtagIA4zvZCeFvPNymZPUjJlpaPBPMJC7w=; b=VQVHXnNrtkCL4D4WlhRrQQGscRYK87tUnvre7KqwxHGhwnfsePz54w54 l2nsZ4X3oazmZtSFfpMgZbF3poDMnaVY0Y7k85n0zT9FUI/0rCopnT++z EJ1b7jqPuH93wg9sUFY1RwlMqvFCrWsuIXTeo4XYQt9XKuuazAHF7G+4t AAkIcuCi8zZtnK+7SNmOLRJ15Lu1KKOvEFQtM4mqxxJK0wXlVVfiaF95E LM5FnE2GKLAWn7tUcqL3kk1dv6QAJoYfMSVwyOZtr+FNw4lPFRnnPcQZF sle84uJYkUE49/8kzKdaJSR3FEMiUoQXaHIYjDjNBlw98dcxAQWsIG7rM Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10435"; a="270869929" X-IronPort-AV: E=Sophos;i="5.93,227,1654585200"; d="scan'208";a="270869929" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2022 07:28:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,227,1654585200"; d="scan'208";a="781246975" Received: from lkp-server02.sh.intel.com (HELO 5d6b42aa80b8) ([10.239.97.151]) by orsmga005.jf.intel.com with ESMTP; 10 Aug 2022 07:28:50 -0700 Received: from kbuild by 5d6b42aa80b8 with local (Exim 4.96) (envelope-from ) id 1oLmhV-0000LO-2y; Wed, 10 Aug 2022 14:28:49 +0000 Date: Wed, 10 Aug 2022 22:28:41 +0800 From: kernel test robot To: Richard Guy Briggs , Linux-Audit Mailing List , LKML , linux-fsdevel@vger.kernel.org Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, Paul Moore , Eric Paris , Steve Grubb , Richard Guy Briggs , Jan Kara , Amir Goldstein Subject: Re: [PATCH v4 2/4] fanotify: define struct members to hold response decision context Message-ID: <202208102231.qSUdYAdb-lkp@intel.com> References: <8767f3a0d43d6a994584b86c03eb659a662cc416.1659996830.git.rgb@redhat.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8767f3a0d43d6a994584b86c03eb659a662cc416.1659996830.git.rgb@redhat.com> Hi Richard, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on jack-fs/fsnotify] [also build test WARNING on pcmoore-audit/next linus/master v5.19 next-20220810] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Richard-Guy-Briggs/fanotify-Allow-user-space-to-pass-back-additional-audit-info/20220810-012825 base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git fsnotify config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220810/202208102231.qSUdYAdb-lkp@intel.com/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/a943676abc023c094f05b45f4d61936c567507a2 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Richard-Guy-Briggs/fanotify-Allow-user-space-to-pass-back-additional-audit-info/20220810-012825 git checkout a943676abc023c094f05b45f4d61936c567507a2 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/notify/fanotify/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> fs/notify/fanotify/fanotify_user.c:325:35: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat] group, fd, response, info_buf, count); ^~~~~ include/linux/printk.h:594:38: note: expanded from macro 'pr_debug' no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) ~~~ ^~~~~~~~~~~ include/linux/printk.h:131:17: note: expanded from macro 'no_printk' printk(fmt, ##__VA_ARGS__); \ ~~~ ^~~~~~~~~~~ include/linux/printk.h:464:60: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ~~~ ^~~~~~~~~~~ include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap' _p_func(_fmt, ##__VA_ARGS__); \ ~~~~ ^~~~~~~~~~~ 1 warning generated. vim +325 fs/notify/fanotify/fanotify_user.c 312 313 static int process_access_response(struct fsnotify_group *group, 314 struct fanotify_response *response_struct, 315 const char __user *buf, 316 size_t count) 317 { 318 struct fanotify_perm_event *event; 319 int fd = response_struct->fd; 320 u32 response = response_struct->response; 321 struct fanotify_response_info_header info_hdr; 322 char *info_buf = NULL; 323 324 pr_debug("%s: group=%p fd=%d response=%u buf=%p size=%lu\n", __func__, > 325 group, fd, response, info_buf, count); 326 /* 327 * make sure the response is valid, if invalid we do nothing and either 328 * userspace can send a valid response or we will clean it up after the 329 * timeout 330 */ 331 if (response & ~FANOTIFY_RESPONSE_VALID_MASK) 332 return -EINVAL; 333 switch (response & FANOTIFY_RESPONSE_ACCESS) { 334 case FAN_ALLOW: 335 case FAN_DENY: 336 break; 337 default: 338 return -EINVAL; 339 } 340 if ((response & FAN_AUDIT) && !FAN_GROUP_FLAG(group, FAN_ENABLE_AUDIT)) 341 return -EINVAL; 342 if (fd < 0) 343 return -EINVAL; 344 if (response & FAN_INFO) { 345 size_t c = count; 346 const char __user *ib = buf; 347 348 if (c <= 0) 349 return -EINVAL; 350 while (c >= sizeof(info_hdr)) { 351 if (copy_from_user(&info_hdr, ib, sizeof(info_hdr))) 352 return -EFAULT; 353 if (info_hdr.pad != 0) 354 return -EINVAL; 355 if (c < info_hdr.len) 356 return -EINVAL; 357 switch (info_hdr.type) { 358 case FAN_RESPONSE_INFO_AUDIT_RULE: 359 break; 360 case FAN_RESPONSE_INFO_NONE: 361 default: 362 return -EINVAL; 363 } 364 c -= info_hdr.len; 365 ib += info_hdr.len; 366 } 367 if (c != 0) 368 return -EINVAL; 369 /* Simplistic check for now */ 370 if (count != sizeof(struct fanotify_response_info_audit_rule)) 371 return -EINVAL; 372 info_buf = kmalloc(sizeof(struct fanotify_response_info_audit_rule), 373 GFP_KERNEL); 374 if (!info_buf) 375 return -ENOMEM; 376 if (copy_from_user(info_buf, buf, count)) 377 return -EFAULT; 378 } 379 spin_lock(&group->notification_lock); 380 list_for_each_entry(event, &group->fanotify_data.access_list, 381 fae.fse.list) { 382 if (event->fd != fd) 383 continue; 384 385 list_del_init(&event->fae.fse.list); 386 /* finish_permission_event() eats info_buf */ 387 finish_permission_event(group, event, response_struct, 388 count, info_buf); 389 wake_up(&group->fanotify_data.access_waitq); 390 return 0; 391 } 392 spin_unlock(&group->notification_lock); 393 394 return -ENOENT; 395 } 396 -- 0-DAY CI Kernel Test Service https://01.org/lkp From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4CA7CC00140 for ; Wed, 10 Aug 2022 16:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660147856; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HAoNINpAu3tby12Jias0X9kQrtHrIF6FuyFszImehzo=; b=g7J15w4kIYdenozNABLX7u4tN3ejbHRXohZpsb3eNIlYBuFdfmP1tr3nVXCZPw/W4DvnuF zlgvMwP9AM8M/CPF47xfn5N2sg096vQCMCiWovN4zOnQQPDjk1kJM7jkEYYlq9w5+Pmew6 8w9oC/296GHfWcFNF6siaCZD2j43fP8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-505-wuBMopUnMeO5O-CBDY6fRQ-1; Wed, 10 Aug 2022 12:10:54 -0400 X-MC-Unique: wuBMopUnMeO5O-CBDY6fRQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 34CC91C01B44; Wed, 10 Aug 2022 16:10:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 153F61415116; Wed, 10 Aug 2022 16:10:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AF8831946A50; Wed, 10 Aug 2022 16:10:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 186DF1946A4F for ; Wed, 10 Aug 2022 14:30:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 019FA1121315; Wed, 10 Aug 2022 14:30:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F21711121314 for ; Wed, 10 Aug 2022 14:30:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D78D819705AA for ; Wed, 10 Aug 2022 14:30:03 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-148-X5uwSS8mOH6tZA3fmpdwBw-1; Wed, 10 Aug 2022 10:30:00 -0400 X-MC-Unique: X5uwSS8mOH6tZA3fmpdwBw-1 X-IronPort-AV: E=McAfee;i="6400,9594,10435"; a="352829848" X-IronPort-AV: E=Sophos;i="5.93,227,1654585200"; d="scan'208";a="352829848" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2022 07:28:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,227,1654585200"; d="scan'208";a="781246975" Received: from lkp-server02.sh.intel.com (HELO 5d6b42aa80b8) ([10.239.97.151]) by orsmga005.jf.intel.com with ESMTP; 10 Aug 2022 07:28:50 -0700 Received: from kbuild by 5d6b42aa80b8 with local (Exim 4.96) (envelope-from ) id 1oLmhV-0000LO-2y; Wed, 10 Aug 2022 14:28:49 +0000 Date: Wed, 10 Aug 2022 22:28:41 +0800 From: kernel test robot To: Richard Guy Briggs , Linux-Audit Mailing List , LKML , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4 2/4] fanotify: define struct members to hold response decision context Message-ID: <202208102231.qSUdYAdb-lkp@intel.com> References: <8767f3a0d43d6a994584b86c03eb659a662cc416.1659996830.git.rgb@redhat.com> MIME-Version: 1.0 In-Reply-To: <8767f3a0d43d6a994584b86c03eb659a662cc416.1659996830.git.rgb@redhat.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mailman-Approved-At: Wed, 10 Aug 2022 16:10:48 +0000 X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amir Goldstein , kbuild-all@lists.01.org, Richard Guy Briggs , Jan Kara , llvm@lists.linux.dev, Eric Paris Errors-To: linux-audit-bounces@redhat.com Sender: "Linux-audit" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Richard, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on jack-fs/fsnotify] [also build test WARNING on pcmoore-audit/next linus/master v5.19 next-20220810] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Richard-Guy-Briggs/fanotify-Allow-user-space-to-pass-back-additional-audit-info/20220810-012825 base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git fsnotify config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220810/202208102231.qSUdYAdb-lkp@intel.com/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/a943676abc023c094f05b45f4d61936c567507a2 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Richard-Guy-Briggs/fanotify-Allow-user-space-to-pass-back-additional-audit-info/20220810-012825 git checkout a943676abc023c094f05b45f4d61936c567507a2 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/notify/fanotify/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> fs/notify/fanotify/fanotify_user.c:325:35: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat] group, fd, response, info_buf, count); ^~~~~ include/linux/printk.h:594:38: note: expanded from macro 'pr_debug' no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) ~~~ ^~~~~~~~~~~ include/linux/printk.h:131:17: note: expanded from macro 'no_printk' printk(fmt, ##__VA_ARGS__); \ ~~~ ^~~~~~~~~~~ include/linux/printk.h:464:60: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ~~~ ^~~~~~~~~~~ include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap' _p_func(_fmt, ##__VA_ARGS__); \ ~~~~ ^~~~~~~~~~~ 1 warning generated. vim +325 fs/notify/fanotify/fanotify_user.c 312 313 static int process_access_response(struct fsnotify_group *group, 314 struct fanotify_response *response_struct, 315 const char __user *buf, 316 size_t count) 317 { 318 struct fanotify_perm_event *event; 319 int fd = response_struct->fd; 320 u32 response = response_struct->response; 321 struct fanotify_response_info_header info_hdr; 322 char *info_buf = NULL; 323 324 pr_debug("%s: group=%p fd=%d response=%u buf=%p size=%lu\n", __func__, > 325 group, fd, response, info_buf, count); 326 /* 327 * make sure the response is valid, if invalid we do nothing and either 328 * userspace can send a valid response or we will clean it up after the 329 * timeout 330 */ 331 if (response & ~FANOTIFY_RESPONSE_VALID_MASK) 332 return -EINVAL; 333 switch (response & FANOTIFY_RESPONSE_ACCESS) { 334 case FAN_ALLOW: 335 case FAN_DENY: 336 break; 337 default: 338 return -EINVAL; 339 } 340 if ((response & FAN_AUDIT) && !FAN_GROUP_FLAG(group, FAN_ENABLE_AUDIT)) 341 return -EINVAL; 342 if (fd < 0) 343 return -EINVAL; 344 if (response & FAN_INFO) { 345 size_t c = count; 346 const char __user *ib = buf; 347 348 if (c <= 0) 349 return -EINVAL; 350 while (c >= sizeof(info_hdr)) { 351 if (copy_from_user(&info_hdr, ib, sizeof(info_hdr))) 352 return -EFAULT; 353 if (info_hdr.pad != 0) 354 return -EINVAL; 355 if (c < info_hdr.len) 356 return -EINVAL; 357 switch (info_hdr.type) { 358 case FAN_RESPONSE_INFO_AUDIT_RULE: 359 break; 360 case FAN_RESPONSE_INFO_NONE: 361 default: 362 return -EINVAL; 363 } 364 c -= info_hdr.len; 365 ib += info_hdr.len; 366 } 367 if (c != 0) 368 return -EINVAL; 369 /* Simplistic check for now */ 370 if (count != sizeof(struct fanotify_response_info_audit_rule)) 371 return -EINVAL; 372 info_buf = kmalloc(sizeof(struct fanotify_response_info_audit_rule), 373 GFP_KERNEL); 374 if (!info_buf) 375 return -ENOMEM; 376 if (copy_from_user(info_buf, buf, count)) 377 return -EFAULT; 378 } 379 spin_lock(&group->notification_lock); 380 list_for_each_entry(event, &group->fanotify_data.access_list, 381 fae.fse.list) { 382 if (event->fd != fd) 383 continue; 384 385 list_del_init(&event->fae.fse.list); 386 /* finish_permission_event() eats info_buf */ 387 finish_permission_event(group, event, response_struct, 388 count, info_buf); 389 wake_up(&group->fanotify_data.access_waitq); 390 return 0; 391 } 392 spin_unlock(&group->notification_lock); 393 394 return -ENOENT; 395 } 396 -- 0-DAY CI Kernel Test Service https://01.org/lkp -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit