Received: by 10.192.165.156 with SMTP id m28csp253116imm; Tue, 17 Apr 2018 09:33:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx49rCPy6Gxtfx4nfhopiKY23dCVJpE3NoVYBP2GXEcm+Ny0H5rSRCf5JOqrBtn/PVLNeOxsF X-Received: by 10.99.117.93 with SMTP id f29mr2245527pgn.401.1523982817909; Tue, 17 Apr 2018 09:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523982817; cv=none; d=google.com; s=arc-20160816; b=Vut2GcyrznxMvjQokgDaHu/xG1feXyZJbQbWAN+aJYdRNQ9ixw/DmKxKFa5FEBLqop lUn7TTdF1Q6ZzSkZ1KYbMneudniHA2GWTK+kCptrbAcqRP41R8/jfo8MItaUmyP9Fgce v8dbOOwdfy+w4AMevcz8jiv73po378uyoD1XjCG9Z398E8oW8N28Qv1YoxupU+/NRhg6 GM6fTa6AyZ9c9Hu7MI+LCGhL0ZSxroKMzXqhRx6r8ekhaWRPIKFYK49h5eN4svCjN970 Qx2FqViNDS+8kE09RG5s4nFdb+z3sq99JrPH7Gkn/AOvwL1uyWaOg61GFuNenIJBawtP tppg== 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=6baTkydM2ocs//sdJBD7RvQWCgkTudrwS7ZvomYNb5c=; b=O/CVsvJ9F3eVcMowxvSESgeNNYTmKUK9y0rv9RQQJPP9cx7ybJFvD0EVhMMeYGfaGT TwN3n3Lc0i3NCWs76a7+n9DN0nWSUqPp12grXo8Y4xvjthcrxAZBFHHvyq2uwDGVNbG/ oqXFKDu33wLamVdfjjyclVCkY8XoOF+BAfcEJlR4+X6E2IShU4blGwI7iVgmxQ9aN4NL IYd5XTKvz7y/GPsbFlcftaOTHD6ZLadjVyXin66h6pzTN7Xa5KYhVZ8SHaSB/yw0w9fO ejEdhbC/EekvStKLyfI99jVajKF10JYLKVFtJuydrdF+4xHh7TE5QKprscBVtm/k76WT thUw== 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 c87si9811782pfk.53.2018.04.17.09.33.23; Tue, 17 Apr 2018 09:33:37 -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 S1755044AbeDQQcH (ORCPT + 99 others); Tue, 17 Apr 2018 12:32:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35394 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754477AbeDQQIB (ORCPT ); Tue, 17 Apr 2018 12:08:01 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E6EB7EF4; Tue, 17 Apr 2018 16:08:00 +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.14 25/49] apparmor: fix resource audit messages when auditing peer Date: Tue, 17 Apr 2018 17:59:04 +0200 Message-Id: <20180417155716.223390678@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155715.032245882@linuxfoundation.org> References: <20180417155715.032245882@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.14-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;