Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp883660ybt; Fri, 10 Jul 2020 15:12:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzARztULmqeohMHhsb17C44BDbdGEc2frKSq0yyEV6Ntj7pD3hzEsczYHe7uM1dDvYsq/jV X-Received: by 2002:aa7:d848:: with SMTP id f8mr70008561eds.329.1594419131468; Fri, 10 Jul 2020 15:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594419131; cv=none; d=google.com; s=arc-20160816; b=ntvi/zmg9u/RXFWNWkPZ5IBxi1vajxxQobEbxBpczzW0W76+RigJo2SxbbepWZkRBC lyJvu8ga+PAOSDBcEzRWrIj1ITsfAAKyvhdabS5ltqP76pZWMicyLyOEGaIjxLTzGE88 x910EyGwdANrDxTI3kaMtDlVF7GUut8CItI/SDWNTigHQNYQ8dYeapDD/mFAeG+Dsb1k MgvZWNiUQglJUNKy9bxrzM5pNWtnHWEWUbvrtxQz8kSHfVGNpQZuzBbSv3TlEKRAoxYO 6e3Vk/brdNHkg4XYu4FzxlLe/9jaZPfax9jA3BoPzp2NiOw+/8WJFrvDKKqkjiwoRbEe CANA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=aibEP9PY7qjIXvWY9ybATGaYnLNWOzVMnBkuiR7TDf8=; b=d5/kBdUvmkcZL5QI8dysfurOmiFZmvSaBn0krvY5zwhpGjNEDJxeE09aEvn1RibEUE XYjp2C0UyRAQVMoMM7sstNNv2TkdY9Jh9AcRrB5B/d6wO+ysseqM1utKgbf7Jmx8qgql lcDCGscDtyRKFU2CajO2w+A7tipPcHeJAkfdQxKgy8vjGHxXq8Sz3IRbywTAI3jINyp9 TQQXRGdfk3q8dVI5lubjo35Zsodj70xrhdnr2ViOx0EWAiZDZ95iKOkHOzORwPATcLTY AHOA6/eFFGRxNB6efvg6ikB05p5/gWzKrhvxneE0fBTI5bSQJJYDg2Bzi+3NyY9v95+Y hWdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=HEBvePuV; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz11si4715540ejb.409.2020.07.10.15.11.46; Fri, 10 Jul 2020 15:12:11 -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=@broadcom.com header.s=google header.b=HEBvePuV; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbgGJWKi (ORCPT + 99 others); Fri, 10 Jul 2020 18:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbgGJWKh (ORCPT ); Fri, 10 Jul 2020 18:10:37 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1657C08C5DD for ; Fri, 10 Jul 2020 15:10:37 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id w17so2792944ply.11 for ; Fri, 10 Jul 2020 15:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=aibEP9PY7qjIXvWY9ybATGaYnLNWOzVMnBkuiR7TDf8=; b=HEBvePuVhen5zXWxLZJ5MAw3GFOvOn+W3aT7QHZHcK+np34JnSw3feprmqOcn1MN9x 4lfLK7rdc6DHLOHjgyBt/ym41ksnQK1EaXiNbS741pAYHB/MHGmGNEW0KfJUZLoAqui/ 3aWQJJlU6S2r8xMzEuTOkhCa581xCJayzSRAw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=aibEP9PY7qjIXvWY9ybATGaYnLNWOzVMnBkuiR7TDf8=; b=mRbUHJkfc8r7IYbX94lW5Wu0dRXIE65PgVAOZshrYMgLauxniUn7xw5GTLkpf2JaaI qzydJWspanIDFSBEUMV734q00xZHdclFdKXqw29m08+vCbb7jmxL7obEWe9Y6XjxXlFp BN1LNMKOOTnHhUDdcsLY00BKFR1yurO7xkhcFqhCoDj+b9Bh9/sMUk7Pp/U+xqdRbYEG 91akCqJU+H7it+VWEyB+7YWIpsEbErmy4hod48PjShvLnjb/uyRg95FnMJJNPJtTyNvN MKf6fwlhnYenWmkJKtmHvaM7MBVkIsb9qLUHVg6opNHdb/1iF5fas/hO2XyCTbkenk4C Ubcg== X-Gm-Message-State: AOAM531yKIsFJ5fdc6Iw5zOmeAWZ7yEsJgSxIQMT4D8CNjZFlMjdmeFP GTwmjt5k/5jw67Airbqsd55zgg== X-Received: by 2002:a17:90a:a60a:: with SMTP id c10mr8349447pjq.117.1594419037224; Fri, 10 Jul 2020 15:10:37 -0700 (PDT) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id b22sm6392055pju.26.2020.07.10.15.10.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jul 2020 15:10:36 -0700 (PDT) Subject: Re: [PATCH 2/4] fs: Remove FIRMWARE_PREALLOC_BUFFER from kernel_read_file() enums To: Matthew Wilcox Cc: Kees Cook , James Morris , Luis Chamberlain , Mimi Zohar , Greg Kroah-Hartman , "Rafael J. Wysocki" , Alexander Viro , Jessica Yu , Dmitry Kasatkin , "Serge E. Hallyn" , Casey Schaufler , "Eric W. Biederman" , Peter Zijlstra , Matthew Garrett , David Howells , Mauro Carvalho Chehab , Randy Dunlap , "Joel Fernandes (Google)" , KP Singh , Dave Olsthoorn , Hans de Goede , Peter Jones , Andrew Morton , Stephen Boyd , Paul Moore , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org References: <20200707081926.3688096-1-keescook@chromium.org> <20200707081926.3688096-3-keescook@chromium.org> <3fdb3c53-7471-14d8-ce6a-251d8b660b8a@broadcom.com> <20200710220411.GR12769@casper.infradead.org> From: Scott Branden Message-ID: <128120ca-7465-e041-7481-4c5d53f639dd@broadcom.com> Date: Fri, 10 Jul 2020 15:10:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200710220411.GR12769@casper.infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-07-10 3:04 p.m., Matthew Wilcox wrote: > On Fri, Jul 10, 2020 at 02:00:32PM -0700, Scott Branden wrote: >>> @@ -950,8 +951,8 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size, >>> goto out; >>> } >>> - if (id != READING_FIRMWARE_PREALLOC_BUFFER) >>> - *buf = vmalloc(i_size); >>> + if (!*buf) >> The assumption that *buf is always NULL when id != >> READING_FIRMWARE_PREALLOC_BUFFER doesn't appear to be correct. >> I get unhandled page faults due to this change on boot. > Did it give you a stack backtrace? Yes, but there's no requirement that *buf need to be NULL when calling this function. To fix my particular crash I added the following locally: --- a/kernel/module.c +++ b/kernel/module.c @@ -3989,7 +3989,7 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)  {      struct load_info info = { };      loff_t size; -    void *hdr; +    void *hdr = NULL;      int err;      err = may_init_module(); >