From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759331AbcIHLBK (ORCPT ); Thu, 8 Sep 2016 07:01:10 -0400 Received: from ozlabs.org ([103.22.144.67]:55126 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759304AbcIHLBI (ORCPT ); Thu, 8 Sep 2016 07:01:08 -0400 From: Rusty Russell To: Jessica Yu , Petr Mladek Cc: Andrew Morton , Jiri Kosina , Josh Poimboeuf , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: module/taint: Automatically increase the buffer size for new taint flags In-Reply-To: <20160908010006.GA26819@packer-debian-8-amd64.digitalocean.com> References: <1473254019-24421-1-git-send-email-pmladek@suse.com> <20160908010006.GA26819@packer-debian-8-amd64.digitalocean.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Thu, 08 Sep 2016 15:35:04 +0930 Message-ID: <871t0v6i5r.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jessica Yu writes: > I liked the enum idea because we got TAINT_FLAGS_COUNT for free :-) > however I think we need to switch back to the #defines because of the kbuild > error. > > The "Error: invalid operands...for `<<'" messages are related to the > __WARN_TAINT() macro (arch/arm64/include/asm/bug.h) which emits some assembly > that relies on the taint values. We don't have access to the enum values > in the assembler so we start getting things like: > > .short ((1 << 0) | ((TAINT_WARN) << 8)) > > where TAINT_WARN should have already been preprocessed, and this is where that > invalid operand error is coming from. Yech. They could use asm-offsets hacks to generate the values, but I think you're right. But I want a single table for taint flags anyway. Let's pull the one out of panic.c, declare it [TAINT_FLAGS_COUNT] so gcc will warn if someone adds one and it no longer fits, and use it in module.c. (Also make it indexed by flag, rather than containing the flag in the struct). Thanks, Rusty.