Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1904982imm; Sat, 28 Jul 2018 05:24:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdNdxzh32PDp0Ud8bCDeqsV50RdEB590gdQkGTPw66rRw62uR7h5/TmgRwaYzJXnXUJtAxO X-Received: by 2002:a63:6383:: with SMTP id x125-v6mr9617736pgb.127.1532780670311; Sat, 28 Jul 2018 05:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532780670; cv=none; d=google.com; s=arc-20160816; b=li6lNvDpeFnhg1melITXn/7yQ+pEj0oIg/YBvX2fgdPkGGvyBzPx0AC3XwYv/qBBaG fGyY9xkuDRUHAjGbfiVn+zq8jKFHBhUKiwc0hPM1zGIsUcL09T3Q+Z4hD3XJbzFMiLoR ix6/YRQpdMFNpi6AcMuIj2wO2b2HgBVeIlSd6Ic6UO9Y+O9+SFjoJA9o2WRsYUxuExBc JaY8oAAE8VZnRWHz2Vd7EPyA4Z59DNz4hRWjqUF2yxj2N4bazg6yOjzFKm6tFESjtnJL AqpFne0sxipJw7eD+utdcz/OkVJVYh6gIcN3wu0g0VuoBhutMLgtWjsAED+9jc3fEtea GFWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=IPn37z2P2lPesPtiNvJYGcSOhfEPsRw54zeAecY2rYw=; b=rx0FxT69JofNNXpgCANbFnDXjRFkxAA7rtMwLC27qNbprZyEQxN6UQSlhUR70+5fDy uF/H3DkUWgiXkBLkFhMUTMi+FcHDOPkF3uj2/Xe97d3znxD5avSgKfyXRdZOI6oPJDKY LS5ceq2kHJATwqHQpWtKUk4vYOA2Kg/0B5Ca58Nwfyf7OeXt8MZ6doFAS5BQSz8z4FuV 0qOt+PJ6UNdKgy489ttnjN2WPDVRDJQrixG+JHEXZDPuprZ+Un//0fjGWbGzWZZZguLD cDl2Ly//+vVB3kq3fGOxBeajU3hhhA2/KpEGutoOzwk5es/S1G+yZw9qIbN2EjppzTtp pkZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8-v6si6018809pfh.353.2018.07.28.05.24.02; Sat, 28 Jul 2018 05:24:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728679AbeG1NtD (ORCPT + 99 others); Sat, 28 Jul 2018 09:49:03 -0400 Received: from mga04.intel.com ([192.55.52.120]:45889 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727777AbeG1NtD (ORCPT ); Sat, 28 Jul 2018 09:49:03 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jul 2018 05:22:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,413,1526367600"; d="scan'208";a="76289552" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by fmsmga001.fm.intel.com with ESMTP; 28 Jul 2018 05:22:39 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1fjOF3-000QkV-Qb; Sat, 28 Jul 2018 20:22:37 +0800 Date: Sat, 28 Jul 2018 20:22:27 +0800 From: kbuild test robot To: Eric Richter Cc: kbuild-all@01.org, linux-integrity , linux-security-module , linux-efi , linux-kernel , David Howells , Seth Forshee , Justin Forbes , Eric Richter Subject: Re: [PATCH 4/4] x86/ima: define arch_get_ima_policy() for x86 Message-ID: <201807282011.jTLIG5hy%fengguang.wu@intel.com> References: <20180725233200.761-5-erichte@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180725233200.761-5-erichte@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: lkp@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on integrity/next-integrity] [also build test WARNING on next-20180727] [cannot apply to v4.18-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Eric-Richter/ima-add-support-for-arch-specific-policies/20180728-072442 base: https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity smatch warnings: security/integrity/ima/ima_policy.c:522 ima_init_arch_policy() error: potential null dereference 'arch_policy_entry'. (kcalloc returns null) vim +/arch_policy_entry +522 security/integrity/ima/ima_policy.c b4c0791e Nayna Jain 2018-07-25 484 b4c0791e Nayna Jain 2018-07-25 485 /* b4c0791e Nayna Jain 2018-07-25 486 * ima_init_arch_policy - convert arch policy strings to rules b4c0791e Nayna Jain 2018-07-25 487 * b4c0791e Nayna Jain 2018-07-25 488 * Return number of arch specific rules. b4c0791e Nayna Jain 2018-07-25 489 */ b4c0791e Nayna Jain 2018-07-25 490 static int __init ima_init_arch_policy(void) b4c0791e Nayna Jain 2018-07-25 491 { b4c0791e Nayna Jain 2018-07-25 492 const char * const *arch_rules; b4c0791e Nayna Jain 2018-07-25 493 const char * const *rules; b4c0791e Nayna Jain 2018-07-25 494 int arch_entries = 0; b4c0791e Nayna Jain 2018-07-25 495 int i = 0; b4c0791e Nayna Jain 2018-07-25 496 b4c0791e Nayna Jain 2018-07-25 497 arch_rules = arch_get_ima_policy(); b4c0791e Nayna Jain 2018-07-25 498 if (!arch_rules) { b4c0791e Nayna Jain 2018-07-25 499 pr_info("No architecture policy rules.\n"); b4c0791e Nayna Jain 2018-07-25 500 return arch_entries; b4c0791e Nayna Jain 2018-07-25 501 } b4c0791e Nayna Jain 2018-07-25 502 b4c0791e Nayna Jain 2018-07-25 503 /* Get number of rules */ b4c0791e Nayna Jain 2018-07-25 504 for (rules = arch_rules; *rules != NULL; rules++) b4c0791e Nayna Jain 2018-07-25 505 arch_entries++; b4c0791e Nayna Jain 2018-07-25 506 b4c0791e Nayna Jain 2018-07-25 507 arch_policy_rules = kcalloc(arch_entries + 1, b4c0791e Nayna Jain 2018-07-25 508 sizeof(*arch_policy_rules), GFP_KERNEL); b4c0791e Nayna Jain 2018-07-25 509 if (!arch_policy_rules) b4c0791e Nayna Jain 2018-07-25 510 return 0; b4c0791e Nayna Jain 2018-07-25 511 b4c0791e Nayna Jain 2018-07-25 512 arch_policy_entry = kcalloc(arch_entries + 1, b4c0791e Nayna Jain 2018-07-25 513 sizeof(*arch_policy_entry), GFP_KERNEL); b4c0791e Nayna Jain 2018-07-25 514 b4c0791e Nayna Jain 2018-07-25 515 /* Convert arch policy string rules to struct ima_rule_entry format */ b4c0791e Nayna Jain 2018-07-25 516 for (rules = arch_rules, i = 0; *rules != NULL; rules++) { b4c0791e Nayna Jain 2018-07-25 517 char rule[255]; b4c0791e Nayna Jain 2018-07-25 518 int result; b4c0791e Nayna Jain 2018-07-25 519 b4c0791e Nayna Jain 2018-07-25 520 result = strlcpy(rule, *rules, sizeof(rule)); b4c0791e Nayna Jain 2018-07-25 521 b4c0791e Nayna Jain 2018-07-25 @522 INIT_LIST_HEAD(&arch_policy_entry[i].list); b4c0791e Nayna Jain 2018-07-25 523 result = ima_parse_rule(rule, &arch_policy_entry[i]); b4c0791e Nayna Jain 2018-07-25 524 if (result) { b4c0791e Nayna Jain 2018-07-25 525 pr_warn("Skipping unknown architecture policy rule: %s\n", rule); b4c0791e Nayna Jain 2018-07-25 526 memset(&arch_policy_entry[i], 0, b4c0791e Nayna Jain 2018-07-25 527 sizeof(*arch_policy_entry)); b4c0791e Nayna Jain 2018-07-25 528 continue; b4c0791e Nayna Jain 2018-07-25 529 } b4c0791e Nayna Jain 2018-07-25 530 arch_policy_rules[i] = &arch_policy_entry[i]; b4c0791e Nayna Jain 2018-07-25 531 i++; b4c0791e Nayna Jain 2018-07-25 532 } b4c0791e Nayna Jain 2018-07-25 533 return i; b4c0791e Nayna Jain 2018-07-25 534 } b4c0791e Nayna Jain 2018-07-25 535 :::::: The code at line 522 was first introduced by commit :::::: b4c0791e0facd968a3e0502a8a544390025a9a38 ima: add support for arch specific policies :::::: TO: Nayna Jain :::::: CC: 0day robot --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation