public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Casey Schaufler <casey@schaufler-ca.com>,
	casey.schaufler@intel.com, jmorris@namei.org,
	linux-security-module@vger.kernel.org, selinux@vger.kernel.org
Cc: kbuild-all@lists.01.org, casey@schaufler-ca.com,
	linux-audit@redhat.com, keescook@chromium.org,
	john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp,
	paul@paul-moore.com, stephen.smalley.work@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v37 18/33] LSM: Use lsmcontext in security_dentry_init_security
Date: Tue, 28 Jun 2022 13:36:55 +0800	[thread overview]
Message-ID: <202206281302.ApiPUdom-lkp@intel.com> (raw)
In-Reply-To: <20220628005611.13106-19-casey@schaufler-ca.com>

Hi Casey,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pcmoore-audit/next]
[also build test WARNING on pcmoore-selinux/next linus/master v5.19-rc4 next-20220627]
[cannot apply to jmorris-security/next-testing]
[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/Casey-Schaufler/integrity-disassociate-ima_filter_rule-from-security_audit_rule/20220628-095614
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git next
config: i386-defconfig (https://download.01.org/0day-ci/archive/20220628/202206281302.ApiPUdom-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/c930a07cebde69363d3633fba8bd4cac46dd1520
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Casey-Schaufler/integrity-disassociate-ima_filter_rule-from-security_audit_rule/20220628-095614
        git checkout c930a07cebde69363d3633fba8bd4cac46dd1520
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   security/security.c: In function 'security_setprocattr':
>> security/security.c:2285:21: warning: variable 'slotname' set but not used [-Wunused-but-set-variable]
    2285 |         const char *slotname;
         |                     ^~~~~~~~


vim +/slotname +2285 security/security.c

  2266	
  2267	/**
  2268	 * security_setprocattr - Set process attributes via /proc
  2269	 * @lsm: name of module involved, or NULL
  2270	 * @name: name of the attribute
  2271	 * @value: value to set the attribute to
  2272	 * @size: size of the value
  2273	 *
  2274	 * Set the process attribute for the specified security module
  2275	 * to the specified value. Note that this can only be used to set
  2276	 * the process attributes for the current, or "self" process.
  2277	 * The /proc code has already done this check.
  2278	 *
  2279	 * Returns 0 on success, an appropriate code otherwise.
  2280	 */
  2281	int security_setprocattr(const char *lsm, const char *name, void *value,
  2282				 size_t size)
  2283	{
  2284		struct security_hook_list *hp;
> 2285		const char *slotname;
  2286		char *termed;
  2287		char *copy;
  2288		int *ilsm = current->security;
  2289		int rc = -EINVAL;
  2290		int slot = 0;
  2291	
  2292		if (!strcmp(name, "interface_lsm")) {
  2293			/*
  2294			 * Change the "interface_lsm" value only if all the security
  2295			 * modules that support setting a procattr allow it.
  2296			 * It is assumed that all such security modules will be
  2297			 * cooperative.
  2298			 */
  2299			if (size == 0)
  2300				return -EINVAL;
  2301	
  2302			hlist_for_each_entry(hp, &security_hook_heads.setprocattr,
  2303					     list) {
  2304				rc = hp->hook.setprocattr(name, value, size);
  2305				if (rc < 0 && rc != LSM_RET_DEFAULT(setprocattr))
  2306					return rc;
  2307			}
  2308	
  2309			rc = -EINVAL;
  2310	
  2311			copy = kmemdup_nul(value, size, GFP_KERNEL);
  2312			if (copy == NULL)
  2313				return -ENOMEM;
  2314	
  2315			termed = strsep(&copy, " \n");
  2316	
  2317			for (slot = 0; slot < lsm_slot; slot++) {
  2318				slotname = lsm_slot_to_name(slot);
  2319				if (!strcmp(termed, lsm_slotlist[slot]->lsm)) {
  2320					*ilsm = slot;
  2321					rc = size;
  2322					break;
  2323				}
  2324			}
  2325	
  2326			kfree(termed);
  2327			return rc;
  2328		}
  2329	
  2330		hlist_for_each_entry(hp, &security_hook_heads.setprocattr, list) {
  2331			if (lsm != NULL && strcmp(lsm, hp->lsmid->lsm))
  2332				continue;
  2333			if (lsm == NULL && *ilsm != LSMBLOB_INVALID &&
  2334			    *ilsm != hp->lsmid->slot)
  2335				continue;
  2336			return hp->hook.setprocattr(name, value, size);
  2337		}
  2338		return LSM_RET_DEFAULT(setprocattr);
  2339	}
  2340	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

  reply	other threads:[~2022-06-28  5:37 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220628005611.13106-1-casey.ref@schaufler-ca.com>
2022-06-28  0:55 ` [PATCH v37 00/33] LSM: Module stacking for AppArmor Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 01/33] integrity: disassociate ima_filter_rule from security_audit_rule Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 02/33] LSM: Infrastructure management of the sock security Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 03/33] LSM: Add the lsmblob data structure Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 04/33] LSM: provide lsm name and id slot mappings Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 05/33] IMA: avoid label collisions with stacked LSMs Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 06/33] LSM: Use lsmblob in security_audit_rule_match Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 07/33] LSM: Use lsmblob in security_kernel_act_as Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 08/33] LSM: Use lsmblob in security_secctx_to_secid Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 09/33] LSM: Use lsmblob in security_secid_to_secctx Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 10/33] LSM: Use lsmblob in security_ipc_getsecid Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 11/33] LSM: Use lsmblob in security_current_getsecid Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 12/33] LSM: Use lsmblob in security_inode_getsecid Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 13/33] LSM: Use lsmblob in security_cred_getsecid Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 14/33] LSM: Specify which LSM to display Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 15/33] LSM: Ensure the correct LSM context releaser Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 16/33] LSM: Use lsmcontext in security_secid_to_secctx Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 17/33] LSM: Use lsmcontext in security_inode_getsecctx Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 18/33] LSM: Use lsmcontext in security_dentry_init_security Casey Schaufler
2022-06-28  5:36     ` kernel test robot [this message]
2022-06-28  8:44     ` kernel test robot
2022-06-28 11:24     ` kernel test robot
2022-06-28  0:55   ` [PATCH v37 19/33] LSM: security_secid_to_secctx in netlink netfilter Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 20/33] NET: Store LSM netlabel data in a lsmblob Casey Schaufler
2022-06-28  0:55   ` [PATCH v37 21/33] binder: Pass LSM identifier for confirmation Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 22/33] LSM: security_secid_to_secctx module selection Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 23/33] Audit: Keep multiple LSM data in audit_names Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 24/33] Audit: Create audit_stamp structure Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 25/33] LSM: Add a function to report multiple LSMs Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 26/33] Audit: Allow multiple records in an audit_buffer Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 27/33] Audit: Add record for multiple task security contexts Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 28/33] audit: multiple subject lsm values for netlabel Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 29/33] Audit: Add record for multiple object contexts Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 30/33] netlabel: Use a struct lsmblob in audit data Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 31/33] LSM: Removed scaffolding function lsmcontext_init Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 32/33] LSM: Add /proc attr entry for full LSM context Casey Schaufler
2022-06-28  0:56   ` [PATCH v37 33/33] AppArmor: Remove the exclusive flag Casey Schaufler
2022-07-12 21:42   ` [PATCH v37 00/33] LSM: Module stacking for AppArmor John Johansen
2022-07-12 21:58     ` Casey Schaufler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202206281302.ApiPUdom-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=casey.schaufler@intel.com \
    --cc=casey@schaufler-ca.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=kbuild-all@lists.01.org \
    --cc=keescook@chromium.org \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox