Received: by 10.192.165.156 with SMTP id m28csp265147imm; Tue, 17 Apr 2018 09:46:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx48jq3s5l7GpmhS2RIvjs7pNFyELoVDmTy62/d20fSjWcSUPqqczJu9ufkvVx/a2CYf7V2VT X-Received: by 2002:a17:902:aa90:: with SMTP id d16-v6mr2706230plr.189.1523983605011; Tue, 17 Apr 2018 09:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523983604; cv=none; d=google.com; s=arc-20160816; b=hGh+GYSHP/XJn3PH6zPwUXBR28cVE+6ZBaKf5x8VOwqt+1fKIF+b13UK39MsEzwkWh Kz+anae01EdLHYs/qkJ/Mv0PLP+GQDNkODGcJUdKLJ94R91c3mkQIYgfLF6yE0844JY8 TI+fIFQwawJKa/n1hcI1onp9+vGPTS3ibFaPijk6xrFW91ERTo4R+6qmaB+86EFpJY6q 3vDRcRLFsLylcVKAjUpSK9KxU3oE7Tn4i98OCjSro2KbiIqchQbV/BcTXvTiz1ApKbl9 BPtmUd5fMc2AxVSjIxp1QPXjpaJ7sARwJo/UvzOletybZ5lkfqi8qbvkNcbBBsRTGP1v Vfcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=e0K9vNoVX3Yts1EUPlL7X3Orx8jDV+fcXdeG8R92zDQ=; b=hZZyqt9Y36kDemT+qF9hU/Mdqg+9OAlQzFYUqjnl0lJT0lcczs6lgNPpu0qkB5I3qN qTGwNmigUB4X9k2LSIuJnskp+bn33ZRJcskpJUpVr1a79UnxaUov/TXqVTqvwQm09x0g w6sa/rl0YogHHcNcB8Drzdh8HlcP4m5ilecHwY2zAwZM3NYj22DuKpyxtaqbfXeH8klV rBAhv8B+6x/a6Kr/KdYn3S/84ckIEBvrIWxY+k9iP/xa97jnx81BCwebM5Ql2M06U3NU h1mdMhXtAnx+iXkqJsVjrVhbV98tGaRSg/7omeXc3jvDGL+vccYrowKO6ddwYNCLImhM /Vcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si11866692pgv.444.2018.04.17.09.46.30; Tue, 17 Apr 2018 09:46:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754818AbeDQQFo (ORCPT + 99 others); Tue, 17 Apr 2018 12:05:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34626 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754739AbeDQQFl (ORCPT ); Tue, 17 Apr 2018 12:05:41 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 85CB5CF2; Tue, 17 Apr 2018 16:05:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Johansen Subject: [PATCH 4.15 40/53] apparmor: fix resource audit messages when auditing peer Date: Tue, 17 Apr 2018 17:59:05 +0200 Message-Id: <20180417155725.064377968@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155723.091120060@linuxfoundation.org> References: <20180417155723.091120060@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: John Johansen commit b5beb07ad32ab533027aa988d96a44965ec116f7 upstream. Resource auditing is using the peer field which is not available when the rlim data struct is used, because it is a different element of the same union. Accessing peer during resource auditing could cause garbage log entries or even oops the kernel. Move the rlim data block into the same struct as the peer field so they can be used together. CC: Fixes: 86b92cb782b3 ("apparmor: move resource checks to using labels") Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman --- security/apparmor/include/audit.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/security/apparmor/include/audit.h +++ b/security/apparmor/include/audit.h @@ -126,6 +126,10 @@ struct apparmor_audit_data { const char *target; kuid_t ouid; } fs; + struct { + int rlim; + unsigned long max; + } rlim; int signal; }; }; @@ -135,10 +139,6 @@ struct apparmor_audit_data { long pos; } iface; struct { - int rlim; - unsigned long max; - } rlim; - struct { const char *src_name; const char *type; const char *trans;