Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp226710pxu; Wed, 7 Oct 2020 01:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCizmrzpnNDL90ozBDURffd2m3m7Jh7uiZwYmQJIwdKUDPH4hIWo7+3V9TZ9drrDzrlhie X-Received: by 2002:a17:906:5f96:: with SMTP id a22mr2133838eju.168.1602058222771; Wed, 07 Oct 2020 01:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602058222; cv=none; d=google.com; s=arc-20160816; b=cP3ELiMsrfRrfXZ/LC+26D8aTBEwrtpVO3OgS9TJ54jRriuu9/+EFO4M0cjd/ReDjx TwLcwm2Z5RS9mpHRCcKjZs8nvyWXOZj7bTDaeo60W7oaiEvbNZ8r4mdMWza9RlIQkwR+ ViRTXoHVo1BYq8qzCjSf0H3xT+EHv//FNU1RQJrlpYdEEvTmbZ8XWcDRlsacafWvgnyA 6+bS5j6Qq5+iKgKbQ+Pe/AL6Rd+AQtu/t1G2cICZnoe1FPVRIfPSI5U4jmGUwYs4x915 xLwMeq6OS8oEi58aB56Sw1OvhFgO9La3j0Mz8dMfk4mouiFQZYxHJSLRctb3Ar3yVrZm WgOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XdqKL5aXm7UjHedQ8Kmd06CRP6H67L61WFTIrlc1Gl8=; b=ZhgimjOKs5tc3+XvUyVCbEp7b+OSvrZe8Tk8bu64DxFpdfqPudPZv/wbhya3WEuOdB O4CMP6zNMSDfs9hGlBk/B0DCq12NxzKnMM50kK/8enew1iZjHp+yUhkZbR4oIXtxt+U2 r5Dvhhp47rsxuD5jiJoJuoG233/aHAQFxrsLwe6+M12BP8BGOSE+J994oVb2U2J2ZpKo KbmCVKGhWkuvE9f0jke/vZS7LrhW1xvWxNaFwwyEK472tUq8OPoYgS907AR1SYTzw6Qv qsGaPFB1YB7S5FtbZLMCQesmt5aKy7VBpM8YLDiS1GLuz1+4r4Vud+UEl1l/LwdDGCvs vhhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YhZGcgka; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si905239edx.548.2020.10.07.01.09.59; Wed, 07 Oct 2020 01:10:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YhZGcgka; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbgJGHCV (ORCPT + 99 others); Wed, 7 Oct 2020 03:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727591AbgJGHCU (ORCPT ); Wed, 7 Oct 2020 03:02:20 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEBC0C061755 for ; Wed, 7 Oct 2020 00:02:19 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id o9so518106plx.10 for ; Wed, 07 Oct 2020 00:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XdqKL5aXm7UjHedQ8Kmd06CRP6H67L61WFTIrlc1Gl8=; b=YhZGcgkapoHP9n4Y4/REoixTmv+p6U1CAxJTQSggCZTXAjkxJWk+78pBOXvzXtOyZh UvIBMEp3Kh5eeLS99uPI9kIU2nQhOFOw8deHsWDIxiMg15a3fsU67DLKtN4+sqBTcsli +XK83VQXwqtQCVXEKhicBmRfYT9TCbG6YwSHY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XdqKL5aXm7UjHedQ8Kmd06CRP6H67L61WFTIrlc1Gl8=; b=pj572MF0N9vjO8WmcLesMciGtOzhcWmKMokaBvYXUo99EjBf8uz6I3+Jw96D9AGAt3 zeYepOyvQcXvlDV/bPpH/eheq7mnFvUvp4YB/qQph4y++dK29BGhNRkrqf1w1PNlEl7G uA3ddCpYIE7YzYe/XTj1tmtcG40lzqiIgbmQAzDecVs9e/9vbC4QKlt2UK87Ojd3B2Qk 0fVjdZAkiI5gQ6q2tvb68c+0YdLKv65PMu+bZFgfW0+tM2gy4JVuHtLdvfm9D3QAN8mM njVz3bOJJzrU8rCXVhkUAHHYRW3tzkD+L8j/PRfOS/nu7ScW3BkKnR7xFJHARBY330XR wahQ== X-Gm-Message-State: AOAM532gSMAjTGzXSarCoH803w2gcIcwiqevhK8XTdO2DI/d3EOqnFyr GyOLRklrCYrH0qESZ0hYRjHBAQ== X-Received: by 2002:a17:90a:3f10:: with SMTP id l16mr1664591pjc.110.1602054139421; Wed, 07 Oct 2020 00:02:19 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h20sm1556665pfo.168.2020.10.07.00.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 00:02:18 -0700 (PDT) Date: Wed, 7 Oct 2020 00:02:17 -0700 From: Kees Cook To: Nathan Chancellor , Greg Kroah-Hartman Cc: James Morris , KP Singh , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] LSM: Fix type of id parameter in kernel_post_load_data prototype Message-ID: <202010062359.01DD51D3@keescook> References: <20201006201115.716550-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201006201115.716550-1-natechancellor@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 06, 2020 at 01:11:15PM -0700, Nathan Chancellor wrote: > Clang warns: > > security/security.c:1716:59: warning: implicit conversion from > enumeration type 'enum kernel_load_data_id' to different enumeration > type 'enum kernel_read_file_id' [-Wenum-conversion] > ret = call_int_hook(kernel_post_load_data, 0, buf, size, id, > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ > security/security.c:715:22: note: expanded from macro 'call_int_hook' > RC = P->hook.FUNC(__VA_ARGS__); \ > ~ ^~~~~~~~~~~ > 1 warning generated. > > There is a mismatch between the id parameter type in > security_kernel_post_load_data and the function pointer prototype that > is created by the LSM_HOOK macro in the security_list_options union. Fix > the type in the LSM_HOOK macro as 'enum kernel_load_data_id' is what is > expected. > > Fixes: b64fcae74b6d ("LSM: Introduce kernel_post_load_data() hook") > Link: https://github.com/ClangBuiltLinux/linux/issues/1172 > Signed-off-by: Nathan Chancellor Ah yes; thank you! Greg, can you add this to your tree? Acked-by: Kees Cook -Kees > --- > include/linux/lsm_hook_defs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h > index d67cb3502310..32a940117e7a 100644 > --- a/include/linux/lsm_hook_defs.h > +++ b/include/linux/lsm_hook_defs.h > @@ -186,7 +186,7 @@ LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode) > LSM_HOOK(int, 0, kernel_module_request, char *kmod_name) > LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents) > LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size, > - enum kernel_read_file_id id, char *description) > + enum kernel_load_data_id id, char *description) > LSM_HOOK(int, 0, kernel_read_file, struct file *file, > enum kernel_read_file_id id, bool contents) > LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf, > > base-commit: dba8648dcab90564b8a11c952c06a9e1153506fb > -- > 2.29.0.rc0 > -- Kees Cook