Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412600rwa; Tue, 23 Aug 2022 04:28:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR6MGiEo4QMMKyqwqmDAnRAAwpCXk7FlPLO4JLONBAsjI3agMbaM7kRstfIb4HwiDyZrDmDP X-Received: by 2002:a17:906:99c5:b0:73d:70c5:1a4f with SMTP id s5-20020a17090699c500b0073d70c51a4fmr8073955ejn.302.1661254129780; Tue, 23 Aug 2022 04:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254129; cv=none; d=google.com; s=arc-20160816; b=Nl1foyKjVRXjrn/G6NnxSB7KAATHvpuYt9fTQ7J27/zRAhaFGI2g48I1Cg+5XOfc43 z0WQY5xAbbE4OoHWaEgsu/ziVv+ogvL3cz3yKZ3eUdpeRknhNrEaoEejRkp0qSrRAME8 RfoF3lpY92C4RZLSLA9HM3at6vYIC1pnee7dv2Rg4VbWOUVtHGr1I1wzAdtY5OmqpQLX BC7QVg/M/uG5s4nMHUpSXbnnc4SWx2n8a/waoayYSsuh6F8hJEaVga47ywtKCyboD+yU U04B5dRH91ACxcsV2IeGwXH9OEVAJHORWVefeqjRyBWdNH6zf7zQ8QMkxm94cMwcn79N 5H9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3dUdzbHlW8bxoUF0vWc5pbnJ/Bl8IHPwo2ZO9lhk0F8=; b=fahCFhbYLXL/dIIcV6JqYIvkDB4I5fqA3oC1Pvo10OCAYsaoeV0f/6x+bSsl2IPfI+ QIqdEKoeNmucdHuhbI9oA4rv2ul4cyk1t9e9c6EmAukY9ncivJyzHpm9X++zaxygFvvZ QRrL0MlZztw2hUC0JyB05LIIeqACieVR6tGLiv38dIKJVuYVVx3p49LyFoBrK7RjMPqQ g8tddbWzhltJJF+VhEzAGSOC2GlPOTa0KQ2F3Xf5SVzN7Y3qJ+66ZYqTyRN5KbIlxSqY aEG2r7z7zDNliEaFBAov2zMsqYtejFsoqwomJv6PRh5p9UEJNMRKRbEL2gZN0rztXg9J lOyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TNp8oYI3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz15-20020a1709077d8f00b0073da54bc52dsi743810ejc.845.2022.08.23.04.28.20; Tue, 23 Aug 2022 04:28:49 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=TNp8oYI3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356564AbiHWKyT (ORCPT + 99 others); Tue, 23 Aug 2022 06:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356303AbiHWKq6 (ORCPT ); Tue, 23 Aug 2022 06:46:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC7186B51; Tue, 23 Aug 2022 02:11:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EC0E3B81C66; Tue, 23 Aug 2022 09:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C9DAC433D7; Tue, 23 Aug 2022 09:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245900; bh=3snwoiy4cWBHxDU94g4Zjmdhsk/Y6rI8r/5Xx86zFWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TNp8oYI3yx6FF2A5d+kSN8lHBsc2wWuIq7B8O+6w8SAQB9xvVNJHxk63agtTxwDgQ 3Q4E1EQpPb6zlWcKRI5qcaI6bq72AL9mkATRIbjgy87Mpl948GTy9Q0NcJ2LnKqV+G GZoq7Y7kdXmccIinfNs+BP2KYYvNJXw5kiSL7R5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Johansen Subject: [PATCH 4.19 225/287] apparmor: Fix failed mount permission check error message Date: Tue, 23 Aug 2022 10:26:34 +0200 Message-Id: <20220823080108.572386086@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: John Johansen commit ec240b5905bbb09a03dccffee03062cf39e38dc2 upstream. When the mount check fails due to a permission check failure instead of explicitly at one of the subcomponent checks, AppArmor is reporting a failure in the flags match. However this is not true and AppArmor can not attribute the error at this point to any particular component, and should only indicate the mount failed due to missing permissions. Fixes: 2ea3ffb7782a ("apparmor: add mount mediation") Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman --- security/apparmor/mount.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/security/apparmor/mount.c +++ b/security/apparmor/mount.c @@ -232,7 +232,8 @@ static const char * const mnt_info_table "failed srcname match", "failed type match", "failed flags match", - "failed data match" + "failed data match", + "failed perms check" }; /* @@ -287,8 +288,8 @@ static int do_match_mnt(struct aa_dfa *d return 0; } - /* failed at end of flags match */ - return 4; + /* failed at perms check, don't confuse with flags match */ + return 6; }