Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1083731rwb; Wed, 9 Nov 2022 12:35:08 -0800 (PST) X-Google-Smtp-Source: AMsMyM4Ri5WG0vnd/DOyDkY579uuxGy4SjQ9jGo3lQFpZyg7owR639+ZPk/qgxQfIPeC3oGHFs4v X-Received: by 2002:a17:907:983:b0:77b:6e40:8435 with SMTP id bf3-20020a170907098300b0077b6e408435mr55174726ejc.570.1668026107808; Wed, 09 Nov 2022 12:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668026107; cv=none; d=google.com; s=arc-20160816; b=hv8DcOUtqTn7byqJYjRyScW4ad8GZkD6Bvqf9U8D19HMjiE2rjTg5aCzSx+w6Vpi1p r7dqT4bS5bJtgE1KbetiM1q5czcrGkFaFrHybNRlZ90AHwQ/Dsc5XbelQvNfQTmwns3y kLcXP2FuXFpAMiA4kLPmrxb7L6c19aCO3UR8jyNyq9mxIqBQ7S0lKzLd+x4HjxKbNCVq whvhx09gymHr5ReR3bzvdoQhJ/+Fq0DRfvtyumQbtykp4SiJL2xjfbHMiN/SAf3g0P7q /G0uT8GNKGy4dUQKGLy89EFbXCTjToXaMZrmQctzhzuTfdURpMuTAchDFa5WrnEqtAOs ZHSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DkZEBtgDxLwh8xU3neb1FAkv2BmAFLuGBlDLcfKRoW8=; b=VAhQBpl7mY7OAGlVeUfywgNqMY8zsftCwy2m9LtUxm5DqcK/2IRnmhZ0tCuSkRucI5 yWbIIsUzoLlLx4ocpKJBo07WeU6ygeAhZgR0sD3sBbY/G895BMoGxjAu1BzNXzthfXNJ MNxNvfcLbEj3A1q1ymzeLaz3KJfmFIExy+svxoqXNqLfG1t7gQdCLvI0kqQQ2rR+I0Q5 oD/NKsA6/NIQL2bRB8rwXuUwSbfKYcjP8Jc3wHxHocpsoDpUnOaeCELxXGTGTyaVB78C PUPUccn/b0uAthQGZnkkL7NS1d92iI/i8Y0lPx9osZg9kWHeRfjHTfdsc8/gJMOiNhDq rEcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=vnj1SQDl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f13-20020a0564021e8d00b0045c98bb5359si20166083edf.590.2022.11.09.12.34.44; Wed, 09 Nov 2022 12:35:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=vnj1SQDl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230434AbiKIUWg (ORCPT + 92 others); Wed, 9 Nov 2022 15:22:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbiKIUW3 (ORCPT ); Wed, 9 Nov 2022 15:22:29 -0500 Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1531B1D335 for ; Wed, 9 Nov 2022 12:22:29 -0800 (PST) Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-13d9a3bb27aso3279fac.11 for ; Wed, 09 Nov 2022 12:22:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DkZEBtgDxLwh8xU3neb1FAkv2BmAFLuGBlDLcfKRoW8=; b=vnj1SQDl8mqR3MmD7DqMUdNfi9EUJZvJILOHciyG+VNOp6U0W8rfmn1+Xt31N+DcQi vDOnwVOnau8LUSczoJ0WHV2krITQHPokBhbZJC4BIkUnl+t4Dat/K/WTsgm/5X4H7YWQ zFVnHpsYmAev6RqZbkyoPpbxfEtuuC5V3kacc7B9jDIVJ86H3JkUSioH5iFiZXPAsk9u +2/qR/DZ7H515xlu6tv/Rw8xxaQ8v68Mmf2Mn0Ren3VUaznJd1IL/5goc6xepZl65XJt fP0AgfYdfvqQpcEsC69in5ywcxiT3s9Q3QxNfKI3qY3mYeuTNkzps4sk3UzAOewW8GKp JWqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DkZEBtgDxLwh8xU3neb1FAkv2BmAFLuGBlDLcfKRoW8=; b=MWhopa3xeVdFvsTpRWd/V/A8mCEC/JEl9IoBdKbK1HxrAlg0fp7kEmYgalAL4HpvwY EV2YxYf4+3Hq0pBrvzaiFj1Z2bAtLJ5+7wo0wHCLMk4OLxGspg2ozpyEGryktYyTvqqI o6sknMSmPVF5sdL5ey0cKp/Ag/dGYg7ecUUtHpjdk8j8Oyd+gj+BI/54XBgr967L1OJE cnVN0pYDX8H/VKa7SD+iOFeFezCzsVocvZYYKFxS/+I/9hMGALmT1H2h2134ap6QfUCG IMx9HhzLG3pnpIsFmyOY9lgdvZ7RSB8Cotzf7UyOL/ZA0uJsROTrQ+SJhdqSsreMFK4J hyFQ== X-Gm-Message-State: ACrzQf2SyuBIkuppnHy8Fmrsp4F3IZqKCR7Rx5LC8qO5OOR2USvhvUI4 SBdYiA1N2KqTx6auyZcURQ3eYEvYdrM7otdMkVEQsmIGyBE9 X-Received: by 2002:a05:6870:f299:b0:13b:ad21:934d with SMTP id u25-20020a056870f29900b0013bad21934dmr36758992oap.172.1668025345426; Wed, 09 Nov 2022 12:22:25 -0800 (PST) MIME-Version: 1.0 References: <20221109143834.GB24561@mail.hallyn.com> In-Reply-To: From: Paul Moore Date: Wed, 9 Nov 2022 15:22:14 -0500 Message-ID: Subject: Re: [GIT PULL] LSM fixes for v6.1 (#1) To: "Serge E. Hallyn" Cc: Linus Torvalds , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 9, 2022 at 3:13 PM Paul Moore wrote: > On Wed, Nov 9, 2022 at 9:38 AM Serge E. Hallyn wrote: > > On Mon, Oct 31, 2022 at 12:22:29PM -0700, Linus Torvalds wrote: > > > On Mon, Oct 31, 2022 at 4:07 AM Paul Moore wrote: > > > > > > > > A single patch to the capabilities code to fix a potential memory leak > > > > in the xattr allocation error handling. Please apply for v6.1-rcX. > > > > > > Pulled. > > > > > > However, I react to the strange test condition. Sure, it's > > > pre-existing, but does it really make sense? > > > > > > It does > > > > > > + if (ret < 0 || !tmpbuf) { > > > + size = ret; > > > + goto out_free; > > > + } > > > > > > and how the heck can 'tmpbuf' be NULL if vfs_getxattr_alloc() succeeded? > > > > I had to go through the history a bit - the !tmpbuf check was added > > > > https://www.spinics.net/lists/stable/msg463010.html > > > > because of a gcc warning. Perhaps there's a better way to tell gcc > > that it can't remain NULL if ret was < 0 ? > > Ooof, that's ugly, but thanks for digging it up. As it turns out I > happen to be working on a patch for vfs_getxattr_alloc() to fix the > return value type right now, but it looks like I'll leave that gcc > hack in place ... although I might leave a comment about it so the > next person doesn't have to wonder. Actually, it looks like there are other similar conditions, e.g. evm_is_immutable(), without such a check and my compiler (gcc v12.2.0) seems okay with it; presumably they fixed the compiler bug? I guess I'll leave the hack in place for commoncap.c but not propagate it elsewhere. -- paul-moore.com