From patchwork Fri May 26 20:17:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9751085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 244BF60246 for ; Fri, 26 May 2017 20:19:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15A692821F for ; Fri, 26 May 2017 20:19:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09418281C3; Fri, 26 May 2017 20:19:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id ED44928179 for ; Fri, 26 May 2017 20:18:58 +0000 (UTC) Received: (qmail 5443 invoked by uid 550); 26 May 2017 20:18:18 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 5260 invoked from network); 26 May 2017 20:18:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y6N4rVBTr0q3tH/7EEwKS4q4QNtJWYofQ2vKhpsEVCo=; b=a7/llqjhwpTUkAOlbb06BE7R4TOTMVAQ8xEqEfMTNJzRL07CB3DW7StCVMJo52kH59 MphKlAsJQtkF5TJNWt91JwVx5QgfnyfZdSPM9IBMRuxsdVuku6s2T9VfNKnGB354/1b6 wpzlhwzkwm65jUsbu/NYlDLHUyByZ5v7O8NQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y6N4rVBTr0q3tH/7EEwKS4q4QNtJWYofQ2vKhpsEVCo=; b=BDUBp6wuHMX1d/9l/E2DCwEedgIh4DJCmdaeVEuOGpv15mebQdEOHpkXEJdZCE5WmW 6xgWEmNEYw52kvxBpMqE92Y7sob6IjSRgKbs4cFtE/yAaofGeUMcsXAP5XagEcgUaKO1 50937zZSFPUbFXWXESGnc/ueF4e0Pid6xb8kSIeeXS7LIbJhMJd0t6CheBhJOHk0ZPAS PKIUpS0aP9p/BzFmhSorlXI1xKjNVG+jbH/hcuCgZrEPYRQLyMo6dW5n1wRyiOCfwWJ+ DgaWHN5oSMKN9+oTkmg5ps14Vqvy+9dLThzQu8gGW3W03Qh9Fx97mZ5N7vUNs9cdnb/H z4PA== X-Gm-Message-State: AODbwcAkoVxkUDL369xfpDVTKdl+CtVHv6iHe7m1ZAlM5qeatfbjLLHh /DEKbEEo7O95t8kk X-Received: by 10.84.238.199 with SMTP id l7mr61380327pln.153.1495829884843; Fri, 26 May 2017 13:18:04 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Kees Cook , Hannes Frederic Sowa , "Signed-off-by : David S . Miller" , Laura Abbott , x86@kernel.org, linux-kernel@vger.kernel.org Date: Fri, 26 May 2017 13:17:10 -0700 Message-Id: <1495829844-69341-7-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495829844-69341-1-git-send-email-keescook@chromium.org> References: <1495829844-69341-1-git-send-email-keescook@chromium.org> MIME-Version: 1.0 Subject: [kernel-hardening] [PATCH v2 06/20] randstruct: Whitelist UNIXCB cast X-Virus-Scanned: ClamAV using ClamSMTP This is another false positive in bad cast detection: net/unix/af_unix.c: In function ‘unix_skb_scm_eq’: net/unix/af_unix.c:1621:31: note: found mismatched rhs struct pointer types: ‘struct unix_skb_parms’ and ‘char’ const struct unix_skb_parms *u = &UNIXCB(skb); ^ UNIXCB is: #define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) And ->cb is: char cb[48] __aligned(8); This is a rather crazy cast, but appears to be safe in the face of randomization, so whitelist it in the plugin. Cc: Hannes Frederic Sowa Cc: Signed-off-by: David S. Miller Signed-off-by: Kees Cook --- scripts/gcc-plugins/randomize_layout_plugin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c index e126ac7874af..bf110915a5aa 100644 --- a/scripts/gcc-plugins/randomize_layout_plugin.c +++ b/scripts/gcc-plugins/randomize_layout_plugin.c @@ -43,6 +43,8 @@ struct whitelist_entry { }; static const struct whitelist_entry whitelist[] = { + /* unix_skb_parms via UNIXCB() buffer */ + { "net/unix/af_unix.c", "unix_skb_parms", "char" }, /* walk struct security_hook_heads as an array of struct list_head */ { "security/security.c", "list_head", "security_hook_heads" }, { }