Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp639870lqh; Fri, 31 May 2024 11:34:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWAqoEnvzDObbn8QfHk/corn1Hem+tPxovo7WZztx4SZBHuWNq8tGFowDHkqr2MGWo07gQMCXJXoG318zWn83IigSQiMATR4dqsi11veA== X-Google-Smtp-Source: AGHT+IGZyG7QDa2Xftxjq3FNpcPZr2N+/cwSxYXei8C0ssaEEy+P0FvYfRdE+SAJ/418MbWIqfB6 X-Received: by 2002:ac8:7d4c:0:b0:43f:fa1e:c8e5 with SMTP id d75a77b69052e-43ffa1ecd86mr24729361cf.8.1717180499526; Fri, 31 May 2024 11:34:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717180499; cv=pass; d=google.com; s=arc-20160816; b=iSg7A3LD+8ugxca0ftFR5hdRb8xOHbnWo3gLgoQGVW9SjubTL2cA/fqnqF94oR+Ryv dITSGnFOthQiVPbv5FnB5lv/H84c/2yMmM4WaVl52iqUwwdOQC27387+5bwrnTSZVjY6 1oFWrmBD6pc4TdKwXFbVHvYX0EQP2DwxEKqD10unl7VEzG7zAFy2i66a8TqIsHYPoyer Hz8xxuxEro6vo5h7rk8cqSmo5QdgFS9dLni/AG9ZDHsqvwA5072lnzYkKKD0owCYYU3o E8RM0LVT2yKa9CAn8YxNXx91sPlZ+BqGhdA3I8eUSHmmrXL4KUp+vUAIlaGFUojXOZj0 NCRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7ajAKtHvE471CPuPKfvRU6jqIKN2/5fnuw4v2uvpYPQ=; fh=vaEbsZONYhNzMrplv7giTwkN3usuTN8iqVfEbjFiIdA=; b=Bp1OyCVcZngWMrXaqUD8793wzHMwUWqLTy3QYNjrAYRXaNKgBs1VHNLlQmEWXWU169 hh8MShMoq63wehH/RlezRRSR59f4uEscKeK+HxFHbdMzWp+7/sVKoOG/aQ8LPolB1ufU 6xsz6Km5zw+UuCgMxU1G53kBvejGajoWi8RsVEG0JqEjc21lWYHli1G7pJhIE3pib8yH 8xE+BTg7k4Fzt0+HHsiTiVUPvfQqxr/Tj1CFamdDZtLwvWh7gOoaXccpG9fKU/pLuNVV VigKEb5vKhreS0PQ7l7PRKkuvg2KmWQxmyD8h8EgpPO0A8KCDXsZujQq5DP+tpvAJZl2 yfCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dblSYSjV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-197302-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197302-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f318a018si289634185a.471.2024.05.31.11.34.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 11:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197302-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dblSYSjV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-197302-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197302-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 18DAA1C23DA4 for ; Fri, 31 May 2024 18:34:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67B9E7E10B; Fri, 31 May 2024 18:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dblSYSjV" Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 506CB7C097 for ; Fri, 31 May 2024 18:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717180491; cv=none; b=Vq/pjxI5b/lBm7zunzg19RRcdblTj4alJRuItfeRZBPfmpdKKsc5aFbnFkCTxPQA21RBJk6xTNpWjy1fnCJZnJW/tL0Ca71zNXpadSn+b4tShynkwguEspQl1mr+BcSJdow+NnKAfIJ3EUSPEBo7GOga80ypEuEzH3ow9HwPtX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717180491; c=relaxed/simple; bh=aSGiikkT6x1TNct0kZEX/uNcjl8Rojs8bZbsZLGio/c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ACSS23yAhFqU07t+0wqU4bzbvZBUj6oHnrYTkjD9iJ8+NA7yOgtY6nqZ+RxEP2u2+9DnPIwaHef/Pu4qeFZLHOTGJtPbDaGAQNiCE4+2LV31wITNbcBopYjy2JTluoPd5uyGzCjea7CuLhi8ihIECOp4DOv6MJhbvbw01J1ukBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dblSYSjV; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52b82d57963so1959905e87.2 for ; Fri, 31 May 2024 11:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717180487; x=1717785287; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7ajAKtHvE471CPuPKfvRU6jqIKN2/5fnuw4v2uvpYPQ=; b=dblSYSjVYGak6B/56e9TVZVB7duaZFqkw1B6kot9jo8ZKcxdvkhkJhmfp3VRV/6kbQ Z6zbq0mw7ks/tILe+31GrVlZq8c2+oneedJPjdduKreHWx9OqrYTF6RTKWHspt2jqadk dBwO/HY8pVFCICXY/ysGsMPBzBR8jqAltyXRuWzKf8AY+KBohino+ePzwqhpKRW6TIz6 v8CHdCpoXl4rkleZ/lc+LCOv4SXyog3TkhGVQO54tan2RvKHCSggf/IwCUKE7EHXEwTg 9jO3tspHLb345HT0sAG9Ukk+QO2NF/UV7uVfoc9sYLSTKFfEh8St9ITMkyC51JFmZquC qk9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717180487; x=1717785287; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7ajAKtHvE471CPuPKfvRU6jqIKN2/5fnuw4v2uvpYPQ=; b=qA9kh+sQZ22d2B8Ifpdba6DeScEuhGVgICACWp2YzamG9QrncNhnztG5KIYWOKeVvK 5ADobCWxZPoaU3Hc5XWeqMnUvLop9iMb4bXCVLhvvol2lpsKbHVWasQA/ykD6uaZrX7n mDYtbMutYG65+2ram1jvjq+9YAM4RHkPcnes+DXoIDk10HgxyH+dnYjLgByBm/aTUcAf vtyFEN0pR0LW0jBeJfuBP9GqWwljGEsLw5xAOr3/e/pGhmsxHC5Dco6JdXIsy/qywUlk O8xgpxGVP2wo7fTXIgWsGVvBU5vT61dFbnyXtiWuYObSt2s5Xl3WdNAE0tQkdWdxRjvi Gzug== X-Forwarded-Encrypted: i=1; AJvYcCUVthvRwMDbEZqXKOjYSs0Fe9XOwFybO4qg1RD8W5E8VqoD7OEelmHcPlwGEk20nfEwILyjGTuLBT4g2knNsiC7f2V5OWfCwcbkDVr1 X-Gm-Message-State: AOJu0YzHiiBi4uqhuS84MmwtT8STGH+vmaJhFvdx0UoDzpKynj7tQJYS mSKNieh/qb8BF0LoCmQNMJUh70LZ2Y0W8yIa8mblHg17TbGkFsfKGQo0xgZhzeU= X-Received: by 2002:a19:c514:0:b0:51e:1bed:13a8 with SMTP id 2adb3069b0e04-52b896aa750mr1679529e87.29.1717180487212; Fri, 31 May 2024 11:34:47 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a31be4f4csm1300160a12.48.2024.05.31.11.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 11:34:46 -0700 (PDT) Date: Fri, 31 May 2024 21:34:43 +0300 From: Dan Carpenter To: Jeff Johnson Cc: Kees Cook , Nikolay Borisov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] x86/boot: add prototype for __fortify_panic() Message-ID: References: <20240529-fortify_panic-v1-1-9923d5c77657@quicinc.com> <0d3f7c58-7fc0-4e8b-b6fb-c4d0d9969ce7@suse.com> <202405310923.78257B2B3@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, May 31, 2024 at 11:28:58AM -0700, Jeff Johnson wrote: > On 5/31/2024 9:28 AM, Kees Cook wrote: > > On Thu, May 30, 2024 at 09:23:36AM -0700, Jeff Johnson wrote: > >> On 5/30/2024 8:42 AM, Nikolay Borisov wrote: > >>> > >>> > >>> On 29.05.24 \u0433. 21:09 \u0447., Jeff Johnson wrote: > >>>> As discussed in [1] add a prototype for __fortify_panic() to fix the > >>>> 'make W=1 C=1' warning: > >>>> > >>>> arch/x86/boot/compressed/misc.c:535:6: warning: symbol '__fortify_panic' was not declared. Should it be static? > >>> > >>> Actually doesn't it make sense to have this defined under ../string.h ? > >>> Actually given that we don't have any string fortification under the > >>> boot/ why have the fortify _* functions at all ? > >> > >> I'll let Kees answer these questions since I just took guidance from him :) > > > > Ah-ha, I see what's happening. When not built with > > CONFIG_FORTIFY_SOURCE, fortify-string.h isn't included. But since misc.c > > has the function definition, we get a warning that the function > > declaration was never seen. This is likely the better solution: > > > > > > diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c > > index b70e4a21c15f..3f21a5e218f8 100644 > > --- a/arch/x86/boot/compressed/misc.c > > +++ b/arch/x86/boot/compressed/misc.c > > @@ -532,7 +532,9 @@ asmlinkage __visible void *extract_kernel(void *rmode, unsigned char *output) > > return output + entry_offset; > > } > > > > +#ifdef CONFIG_FORTIFY_SOURCE > > void __fortify_panic(const u8 reason, size_t avail, size_t size) > > { > > error("detected buffer overflow"); > > } > > +#endif > > > > > > Jeff, can you test this? (I still haven't been able to reproduce the > > warning.) > > Adding Dan since this comes during: > CHECK arch/x86/boot/compressed/misc.c > > What version of smatch are you using? I'm using v0.5.0-8639-gff1cc4d453ff The "warning: symbol '__fortify_panic' was not declared. Should it be static?" warning is from Sparse, not Smatch. So probably that's why you can't reproduce it. regards, dan carpenter