Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp620545ybr; Fri, 22 May 2020 15:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIeRZnBmCV97n8xfXEtsgnLfia+X74ZjvvTV7Sbpu+piUlpx6bsbI2gPCDD2apso0SwnJd X-Received: by 2002:a17:906:4009:: with SMTP id v9mr9624704ejj.63.1590184932306; Fri, 22 May 2020 15:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590184932; cv=none; d=google.com; s=arc-20160816; b=ZrXETH1OdCwxr4s8omIxmP0FRjLWupAHWmCEnqL6Xvn5k9uwmHPBsFquuRkuvW8nFS 8MmMzsuVoOsJsjqkYuyLFZeBYS6Dp4METrbjAh3fpfXUqls4NMA8JUF05ezqLYyXyBXg uxtx5kVomuZQqvh4oA2kqZVhSujJqCbFnxFtFokYeYr9+RLbysBJLkTfAA/69KmeIvtm B57nBJlvZ5ldIjd3tVv2THj9ek+415gzZwJiJ02S5KENxDUCdNzZQPLC8ksqG7v0DnBx Y6MnbbT9Yris/mwU52c3vRmHrx7vPG42Ml6eJSiiGaNS3xn2d42z7vpXnIcm074ri0jm JqWQ== 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=+R2PmX2GuncA9li2cFF1oFkmpDyEHWXLGTSivDcpNJU=; b=JG0SzjvxdL0bMPJxlLi0zsIm16Q3V7VZc3d+dB8/nUsk+PlWHNy0pwe+sPW1sh1hiV x0ZNSa1YgZNs4B//zmNHRhFgPzuKpAm4PyXvI9STVB22KqDZ54JEqEZlJM++25uZchc1 8m1dbeKBCCVcKAz6MjiHgCK6JWgnEXlv7wpAomd7rmwWUrGMnrJrO6YZbT0unjAVMA15 Dh8Ea7eplZIuIQOEyY23OgwPmCORvJ18KfYWH+gcPBsVK86abirP80n+zPXT1pZrQGLI rnoDQkista7G4+DDZhwnud520tzb+g+ZOSRTncbM4y7YDqu93yRgkdQcmZMpvXaaeeZZ 0baw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=XLH11UJO; 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 qp5si5577092ejb.629.2020.05.22.15.01.47; Fri, 22 May 2020 15:02:12 -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=XLH11UJO; 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 S1731112AbgEVWAL (ORCPT + 99 others); Fri, 22 May 2020 18:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731074AbgEVWAJ (ORCPT ); Fri, 22 May 2020 18:00:09 -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 77806C08C5C0 for ; Fri, 22 May 2020 15:00:09 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id a13so4953489pls.8 for ; Fri, 22 May 2020 15:00:09 -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=+R2PmX2GuncA9li2cFF1oFkmpDyEHWXLGTSivDcpNJU=; b=XLH11UJOh/L9Rl5FkPR5BqxDsMzqlH+S7zE1uz0zGHDAtRCNTICnmgbYz/8nUUylNr LKqrpsPFT8+TgcTkRKhMVk34mTmI9RwD22c6+fXPQHWZ1iSxtEw8y9DHhEgsEZdckCAr BWw6ztHmgIuOU5I8xXQeY+urp4ky/qUrwdq/k= 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=+R2PmX2GuncA9li2cFF1oFkmpDyEHWXLGTSivDcpNJU=; b=QPKRhwwzA6J3oyVzfDS/mLmSBh8KYWkjpzbYTZwvWT0OTieIAJ5EHXFUgdyhfCxZKF IDRtrRSNZdhsSUcm2SK6WHXOUGSiYlUj/F1IJTNA8V7jfFg5DXXk+YIKNfDKhj+KFYsu CTK98E7l1FftuPfebUE5b4PWoO+FBEv+gR9u/KQPaQAlJt5fcCMxdGbuMuUfakyMN4m8 q9YFeCijUI8mj988FJhsxAMxN0E9cqe++E7rHxZD/9XDN9lCCgEH4G4VEg+zfA4qk1Mc QIgFnSQkLtyDTGz+e0bdamjadtOKPDwTqTkJrblI2Rqjd50SEMNcpuAq5BLsOrJOKoCR sf+Q== X-Gm-Message-State: AOAM531x2bKjYusv9PrArxtJmEoxJc8RONMiqjhMZ7WZx1vdSmKFUKHP NChTf71UBiQqUhFyEwU1xKoY80o4PplKKE+q/4sGFTbCSaIf+N45ZBLkM1r8fA7ue25IYCxdW3a zyOkdYyPj/3n3ZKUCJoFGRGH7KFWnSgt3R/y2rMW/onWLG0UxTfaMTAzw7X27Ij/m5f5EKGBwnB SkdEzleePz X-Received: by 2002:a17:90a:da05:: with SMTP id e5mr7216725pjv.140.1590184808410; Fri, 22 May 2020 15:00:08 -0700 (PDT) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id q12sm6752584pfn.129.2020.05.22.15.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 May 2020 15:00:07 -0700 (PDT) Subject: Re: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd() To: Luis Chamberlain , Al Viro , Kees Cook , Mimi Zohar , linux-security-module , James Morris , "Serge E. Hallyn" , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh Cc: Shuah Khan , Jens Axboe , Linux FS Devel , "linux-kernel@vger.kernel.org" References: <1159d74f88d100521c568037327ebc8ec7ffc6ef.1589311577.git.skhan@linuxfoundation.org> <20200513054950.GT23230@ZenIV.linux.org.uk> <20200513131335.GN11244@42.do-not-panic.com> From: Scott Branden Message-ID: <2d298b41-ab6f-5834-19d2-7d3739470b5f@broadcom.com> Date: Fri, 22 May 2020 14:59:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: 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 Hi Luis, On 2020-05-13 7:19 a.m., Luis Chamberlain wrote: > On Wed, May 13, 2020 at 7:13 AM Luis Chamberlain wrote: >> On Wed, May 13, 2020 at 06:49:50AM +0100, Al Viro wrote: >>> On Tue, May 12, 2020 at 01:43:05PM -0600, Shuah Khan wrote: >>>> diff --git a/fs/exec.c b/fs/exec.c >>>> index 06b4c550af5d..ea24bdce939d 100644 >>>> --- a/fs/exec.c >>>> +++ b/fs/exec.c >>>> @@ -1021,8 +1021,8 @@ int kernel_read_file_from_fd(int fd, void **buf, loff_t *size, loff_t max_size, >>>> goto out; >>>> >>>> ret = kernel_read_file(f.file, buf, size, max_size, id); >>>> -out: >>>> fdput(f); >>>> +out: >>>> return ret; >>> Incidentally, why is that thing exported? >> Both kernel_read_file_from_fd() and kernel_read_file() are exported >> because they have users, however kernel_read_file() only has security >> stuff as a user. Do we want to get rid of the lsm hook for it? > Alright, yeah just the export needs to be removed. I have a patch > series dealing with these callers so will add it to my queue. When will these changes make it into linux-next? It is difficult for me to complete my patch series without these other misc. changes in place. > > Luis Regards,  Scott