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 1DA50C433F5 for ; Tue, 29 Mar 2022 01:50:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-641-AB35ldMdNzStvJ__FLKD5Q-1; Mon, 28 Mar 2022 21:50:02 -0400 X-MC-Unique: AB35ldMdNzStvJ__FLKD5Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EBFAA8FD0A6; Tue, 29 Mar 2022 01:50:00 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52473465170; Tue, 29 Mar 2022 01:49:59 +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 1B1991949762; Tue, 29 Mar 2022 01:49:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 686241947BBF for ; Tue, 29 Mar 2022 01:48:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5A5D51400C2D; Tue, 29 Mar 2022 01:48:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56ADC1400C2B for ; Tue, 29 Mar 2022 01:48:24 +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 33217101AA42 for ; Tue, 29 Mar 2022 01:48:12 +0000 (UTC) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-LBWU4IQiOHymt-kmwXmf_g-1; Mon, 28 Mar 2022 21:48:05 -0400 X-MC-Unique: LBWU4IQiOHymt-kmwXmf_g-1 Received: by mail-qk1-f169.google.com with SMTP id d65so9514258qke.5; Mon, 28 Mar 2022 18:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:from:to:cc:subject:references :mime-version:content-disposition:in-reply-to; bh=AawDJ9kX/dAfzHx8j8PvkYqiVyZFKLPmskAntPro/To=; b=JE7UukY/mCX/MyLvy9UE8iSNx5lyIbC4D58NJevN4rVTv7tDKGYpjTgPu/AhmoTGcQ BGVITuOsc9vPyszpHdCr7oyFgVdYt5j5dpeG8EFMggTjvLS7bghbU706JC+ZJBmMcGBy 9zaFvLaMArYhaETM2p0E1vDSP8lZCcH88vgsmg+/lgo0Ayhe/oC2A5zRDKRJGqxKsC4t rFlj4NT3mjNEGtf4mgx3COu617di1cIAmTK5SV9cwQHSnZw0oTWEwMzXv1FbCuGzzcMN gAUVBs5EuEOszMz+mjr8yvKjPNAkXPSqPqaKHPjsAaLYVivdyNi1s5PHkl1zbktw/aYO c5sQ== X-Gm-Message-State: AOAM531oli1I7KLOpSU0WkUKpiTVDeAY+sABisx2pOmmuCg7wckbvjl9 4n9Mld0g3g2vcyhZEE/bEjM= X-Google-Smtp-Source: ABdhPJygSH5aMysv6jIECEWNSss09AECuOVINBykvHLmuRLTI4v4iiXnecfZGswBNs49QRnrZQj+aQ== X-Received: by 2002:a05:620a:458a:b0:67d:7140:5a6d with SMTP id bp10-20020a05620a458a00b0067d71405a6dmr18283592qkb.387.1648518484564; Mon, 28 Mar 2022 18:48:04 -0700 (PDT) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id h22-20020a05620a245600b0067d6dae634csm9946284qkn.9.2022.03.28.18.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 18:48:03 -0700 (PDT) Message-ID: <62426553.1c69fb81.bb808.345c@mx.google.com> X-Google-Original-Message-ID: <20220329014801.GA2374506@cgel.zte@gmail.com> Date: Tue, 29 Mar 2022 01:48:01 +0000 From: CGEL To: rth@twiddle.net, ink@jurassic.park.msu.ru, mattst88@gmail.com, paul@paul-moore.com Subject: Re: [PATCH] audit: do a quick exit when syscall number is invalid References: <20220326094654.2361956-1-yang.yang29@zte.com.cn> <202203270449.WBYQF9X3-lkp@intel.com> MIME-Version: 1.0 In-Reply-To: <202203270449.WBYQF9X3-lkp@intel.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.85 on 10.11.54.7 X-Mailman-Approved-At: Tue, 29 Mar 2022 01:49:58 +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: kbuild-all@lists.01.org, Zeal Robot , linux-kernel@vger.kernel.org, eparis@redhat.com, Yang Yang , linux-audit@redhat.com Errors-To: linux-audit-bounces@redhat.com Sender: "Linux-audit" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Sun, Mar 27, 2022 at 04:55:01AM +0800, kernel test robot wrote: > Hi, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on pcmoore-audit/next] > [also build test ERROR on v5.17 next-20220325] > [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] > > url: https://github.com/intel-lab-lkp/linux/commits/cgel-zte-gmail-com/audit-do-a-quick-exit-when-syscall-number-is-invalid/20220326-174904 > base: https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git next > config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20220327/202203270449.WBYQF9X3-lkp@intel.com/config) > compiler: alpha-linux-gcc (GCC) 11.2.0 > 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/052b1a11a0bec23358ecc22ad9b085590efd3057 > git remote add linux-review https://github.com/intel-lab-lkp/linux > git fetch --no-tags linux-review cgel-zte-gmail-com/audit-do-a-quick-exit-when-syscall-number-is-invalid/20220326-174904 > git checkout 052b1a11a0bec23358ecc22ad9b085590efd3057 > # save the config file to linux build tree > mkdir build_dir > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=alpha SHELL=/bin/bash > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > > All errors (new ones prefixed by >>): > > In file included from include/linux/init.h:5, > from kernel/auditsc.c:34: > kernel/auditsc.c: In function '__audit_syscall_exit': > >> kernel/auditsc.c:2081:61: error: 'NR_syscalls' undeclared (first use in this function); did you mean 'si_syscall'? > 2081 | unlikely(context->major < 0 || context->major > NR_syscalls)) > | ^~~~~~~~~~~ Sorry could anybody give a hand to solve this? It works well on x86_64 and arm64. I have no alpha environment and not familiar to this arch, much thanks! > include/linux/compiler.h:78:45: note: in definition of macro 'unlikely' > 78 | # define unlikely(x) __builtin_expect(!!(x), 0) > | ^ > kernel/auditsc.c:2081:61: note: each undeclared identifier is reported only once for each function it appears in > 2081 | unlikely(context->major < 0 || context->major > NR_syscalls)) > | ^~~~~~~~~~~ > include/linux/compiler.h:78:45: note: in definition of macro 'unlikely' > 78 | # define unlikely(x) __builtin_expect(!!(x), 0) > | ^ > > > vim +2081 kernel/auditsc.c > > 2063 > 2064 /** > 2065 * __audit_syscall_exit - deallocate audit context after a system call > 2066 * @success: success value of the syscall > 2067 * @return_code: return value of the syscall > 2068 * > 2069 * Tear down after system call. If the audit context has been marked as > 2070 * auditable (either because of the AUDIT_STATE_RECORD state from > 2071 * filtering, or because some other part of the kernel wrote an audit > 2072 * message), then write out the syscall information. In call cases, > 2073 * free the names stored from getname(). > 2074 */ > 2075 void __audit_syscall_exit(int success, long return_code) > 2076 { > 2077 struct audit_context *context = audit_context(); > 2078 > 2079 if (!context || context->dummy || > 2080 context->context != AUDIT_CTX_SYSCALL || > > 2081 unlikely(context->major < 0 || context->major > NR_syscalls)) > 2082 goto out; > 2083 > 2084 /* this may generate CONFIG_CHANGE records */ > 2085 if (!list_empty(&context->killed_trees)) > 2086 audit_kill_trees(context); > 2087 > 2088 /* run through both filters to ensure we set the filterkey properly */ > 2089 audit_filter_syscall(current, context); > 2090 audit_filter_inodes(current, context); > 2091 if (context->current_state < AUDIT_STATE_RECORD) > 2092 goto out; > 2093 > 2094 audit_return_fixup(context, success, return_code); > 2095 audit_log_exit(); > 2096 > 2097 out: > 2098 audit_reset_context(context); > 2099 } > 2100 > > -- > 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