Received: by 10.192.165.156 with SMTP id m28csp270942imm; Tue, 17 Apr 2018 09:53:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx494pcSDAf6MkSfBxj4p4UWPGcQaE7esj/SZfl3w0NSBJgzwBEYRt5rVuIxXuwY7eXB18rGn X-Received: by 2002:a17:902:7844:: with SMTP id e4-v6mr2711100pln.296.1523983991226; Tue, 17 Apr 2018 09:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523983991; cv=none; d=google.com; s=arc-20160816; b=mvuFbn30xGyixwZzFvQDs263ErggmR/ehKNMe9YKjo28HOGYdMOhmRg4Mvq3x3Qi25 sQY/HuFisGzRrGyf5TPckaWrn8/PJXAHL2p0oOhOK5hw930PNHYZ0P6kDPShyWZ3qIEX egYihmq02miK2c7wsj2qxceY4HDTpraRL++mZ3QIvhew+CQuAZFCFDWCY1uqRai3jVsj EQJPxBZfy76T0QbQUr/fqtfPH9tO3y8+xZ1p8tUrnMEW9gzyQXXm9gtzZADfKn01wDY/ 3AI8KzgO1zPKfDbKkpV4hN0AP710Tlk30ji3yV3i62DOGOyRfyp0s8SQDj+lvOiFDUzY PfXw== 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=0v163CqwVBUrHmJe//CfCqwRTymrOoBxcHphQd5dB5o=; b=r32zMk8TzrIIuEotBcJSWXgTg0M5KlQRgY8pnTUSrRe1UbDhIk+KEE+R4B4IndLrCB CMBijZxR8gA2gzGTmGqw4ta9mV/bBekMF+25XueWkGoEwR/Bn2PtWrCKUOvaun91YTc8 7ZsqRI6ICQlT+qzTueb90wBCzBMDYf3OYeYwJonp32FexC+2eFMUxlUyIyQLf9VkzWBu ttJ4oTeVq9FaBrD3fWvXV5fT5wYz61GEFq6CH6QrSPi/ZMSJxD9dOdtZft6XSgG+HaoO kJ3lV6JoFEkg96b8HurWIyE4VObcCs91MnaQTW9yVfe5rUHChHqu9bUKXPES9mK1aYOc mTnQ== 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 s3si12007281pgr.421.2018.04.17.09.52.56; Tue, 17 Apr 2018 09:53:11 -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 S1754606AbeDQQvs (ORCPT + 99 others); Tue, 17 Apr 2018 12:51:48 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34224 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754501AbeDQQEj (ORCPT ); Tue, 17 Apr 2018 12:04:39 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 44A58E56; Tue, 17 Apr 2018 16:04:36 +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 38/53] apparmor: fix logging of the existence test for signals Date: Tue, 17 Apr 2018 17:59:03 +0200 Message-Id: <20180417155724.975046596@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 98cf5bbff413eadf1b9cb195a7b80cc61c72a50e upstream. The existence test is not being properly logged as the signal mapping maps it to the last entry in the named signal table. This is done to help catch bugs by making the 0 mapped signal value invalid so that we can catch the signal value not being filled in. When fixing the off-by-one comparision logic the reporting of the existence test was broken, because the logic behind the mapped named table was hidden. Fix this by adding a define for the name lookup and using it. Cc: Stable Fixes: f7dc4c9a855a1 ("apparmor: fix off-by-one comparison on MAXMAPPED_SIG") Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman --- security/apparmor/include/sig_names.h | 4 +++- security/apparmor/ipc.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/security/apparmor/include/sig_names.h +++ b/security/apparmor/include/sig_names.h @@ -2,6 +2,8 @@ #define SIGUNKNOWN 0 #define MAXMAPPED_SIG 35 +#define MAXMAPPED_SIGNAME (MAXMAPPED_SIG + 1) + /* provide a mapping of arch signal to internal signal # for mediation * those that are always an alias SIGCLD for SIGCLHD and SIGPOLL for SIGIO * map to the same entry those that may/or may not get a separate entry @@ -56,7 +58,7 @@ static const int sig_map[MAXMAPPED_SIG] }; /* this table is ordered post sig_map[sig] mapping */ -static const char *const sig_names[MAXMAPPED_SIG + 1] = { +static const char *const sig_names[MAXMAPPED_SIGNAME] = { "unknown", "hup", "int", --- a/security/apparmor/ipc.c +++ b/security/apparmor/ipc.c @@ -174,7 +174,7 @@ static void audit_signal_cb(struct audit audit_signal_mask(ab, aad(sa)->denied); } } - if (aad(sa)->signal < MAXMAPPED_SIG) + if (aad(sa)->signal < MAXMAPPED_SIGNAME) audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]); else audit_log_format(ab, " signal=rtmin+%d",