Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3408491rwa; Tue, 23 Aug 2022 04:24:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR4vFo0MQJJ3Rh8xkPV4Pk+U0lGnM/m4vNq0/9oFSRIGPn9xlHEMpvkG7+wxbNgQ5pUKL47F X-Received: by 2002:a17:90a:604e:b0:1fa:c865:eabb with SMTP id h14-20020a17090a604e00b001fac865eabbmr2906264pjm.46.1661253859705; Tue, 23 Aug 2022 04:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253859; cv=none; d=google.com; s=arc-20160816; b=gL85M8gHyugJuGSKvw+4qQaXc9CftI2+mxvS2okqka/TGp8689k9zbWz7SFM5ARXX7 l9IAOUVI8rJsA5w1Z70j8vFFeV9ymIXuW+OuoLR9m39h9QeakPqAzQVMSKSNZxBv3Nv+ gkTe2Gu8r2sJuoUpmSrQ4Ond+ScL1miZkjPLDIAf6UNI+XJFJsC0i2e+e6i6taw+rbny x9KqeiNmi3OWVontsvekGlAVfJ+MPXolGSLMZo4hLj+89XA0A6IZRUb63MU8hw2IZA+p zEId21fUTg66EYvBTo6oLQM8YMdX4qCSaGFu3yYIoqaMWyN0Zn3yq0kvkVLFPJp947vT KeLw== 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=p6181vfpuLoc5W0zqYiuIb6vWFkHXt5RBGABYDhfK14=; b=xylCT5ZthdnFLSipMUKxXPLOFFBqckAPDnWvwZAvSJfhxUjGWbUuqH11mu5l43Ir6U NpaBRVzJQmiREVFJSsmcUSgGa7krn3MBBw/sG7HMjD3ZM0TJNnsY2OtJyUeIyUgDCO5s XkqLKFO9k3xRQxglzjN1gXuViJ/AlAylz0pyXmEtZVQ+nHsiZc40bY+KgW/Ykh3Pu15j Rx9zVKp4q4AzinzlGVmyjOA7SyHvrItfpfk9B/Tr1+Wa7H7yRVGF7lXxjFGJoVy4vROR mbRLRgzIN7nZbU4+MoF7za5FUFW9x1zTis2OyS4Bnl9WgrmgZM4Be4MlQDCv+SNe4h+M aElA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K1lNCSg7; 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 w2-20020a170902e88200b0017271ea0ebfsi17187636plg.142.2022.08.23.04.24.08; Tue, 23 Aug 2022 04:24:19 -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=K1lNCSg7; 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 S1352948AbiHWKMp (ORCPT + 99 others); Tue, 23 Aug 2022 06:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352622AbiHWKF6 (ORCPT ); Tue, 23 Aug 2022 06:05:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 419C97171C; Tue, 23 Aug 2022 01:52:16 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 7E478611DD; Tue, 23 Aug 2022 08:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 804EFC433C1; Tue, 23 Aug 2022 08:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244734; bh=j8glXLaB887gBfr17FRE16vXIkJMGlKP3T3etGltaow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K1lNCSg7S1h2dg2TnTjSwL2vTbltGikzDzuAlyw+2rsrUjoxFBU0P80c3Km+1Lr2v DsWSqQ8GUM9alkanKq/YGnJqYQiWpkb9pIX6Ja9lhR4wD3DJGl1fTt6/cQMR5DvujR z0GBXim9U/WbQUUp6y/oGwU1BqVOskUcE5WtmogM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Johansen Subject: [PATCH 4.14 182/229] apparmor: Fix failed mount permission check error message Date: Tue, 23 Aug 2022 10:25:43 +0200 Message-Id: <20220823080100.111525150@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 @@ -233,7 +233,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" }; /* @@ -288,8 +289,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; }