From owner-svn-src-head@freebsd.org Wed Nov 13 04:44:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADEA017DC17 for ; Wed, 13 Nov 2019 04:44:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47CX8c4KSdz4Xd8 for ; Wed, 13 Nov 2019 04:44:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf2f.google.com with SMTP id s18so306182qvr.4 for ; Tue, 12 Nov 2019 20:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BcFCRi0c9lezrJzbmwkIKvmq8p5WM2tejFH3tEg4rsE=; b=UtZiCnJMP5BznIts+tZ6ecuJPPPspYqjXyA0wTDFgir7CPASgISLwt3hg5jF0Q2rJU l5xniNisBj/rW80WGkiT26tuqgrrnkbhyfhEfmLsCon20qAbsVy2odlR4zdd7DDnEfVC Katb4vSLHSv/glvuEUq2J9Wr8tep9e2n0I7IQEVnhwSDF4r94mf1d549v99ZrH9UTg+h 9gSkBSWwe91JOx6cjNXGUiga9wNuK16dJ5+4p5ABrNyPJkwAQf1YRr336tSFhra7f4Wj Ln+7MnjHZkJpBBCJ2wiDxmkSnp/HNGducDjRObIpD4c9oMarnhv7N7hYtlgD8le8ehbb jnIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BcFCRi0c9lezrJzbmwkIKvmq8p5WM2tejFH3tEg4rsE=; b=G1EgMpvEjs2Z40hjtbmRsRMyPmeWdTEw9uOGtOt8N4TudOLWzbhGR+ZS7sm45xEFMe fGhVpsfwYEIOVHBUPc5+YaT75e+o11tLD3pKHM+wXDaIT/SGYQ2zTUD3S5+SziIyF2g8 p+rgvVqe5Idwb8DSldV7jAlEFIYlHLyRxkKkrCp/0mlribJmZHCItG2r6X/gg7eaDzE6 9iCmSla/cpOEK4IGrz0MY28UifGIy6cCgetydrzskvElb+PsbF/PneVGKhdxldMhwrlN gIvm1u8mdYI8V/kuOE1hBNNPUJDRSBYshHYNHy0tV2Hj6CWMRn2KVN7MxTHAn80z83vl b0vw== X-Gm-Message-State: APjAAAWOnMqYrS0sY571s90Bn5hPsLVipkDzHVF/7LQnlYWou7aY55+g QHjmxZOs7Xbhr1u50WD1ArNPSpa+eat8Dr8IUIw/TIj0KeY= X-Google-Smtp-Source: APXvYqy3W/6FLwRIYqGTDM9seE2j3XMSmz+j8Wz01avmaee6UpY0tmtNkmdQtf/hQH3nxwSNSRFycCcQAKO/36SOlO4= X-Received: by 2002:a0c:e74d:: with SMTP id g13mr1148325qvn.125.1573620281830; Tue, 12 Nov 2019 20:44:41 -0800 (PST) MIME-Version: 1.0 References: <201911130300.xAD30WUE099996@repo.freebsd.org> <80479651-f60d-e352-1f40-f01939aff9fd@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Tue, 12 Nov 2019 21:44:30 -0700 Message-ID: Subject: Re: svn commit: r354672 - head/lib/libc/secure To: Kyle Evans Cc: Pedro Giffuni , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47CX8c4KSdz4Xd8 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=UtZiCnJM; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f2f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.88 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.88)[ipnet: 2607:f8b0::/32(-2.33), asn: 15169(-2.00), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 04:44:49 -0000 On Tue, Nov 12, 2019 at 9:20 PM Kyle Evans wrote: > > > On Tue, Nov 12, 2019, 22:04 Pedro Giffuni wrote: > >> >> On 12/11/2019 22:00, Kyle Evans wrote: >> >> Author: kevans >> Date: Wed Nov 13 03:00:32 2019 >> New Revision: 354672 >> URL: https://svnweb.freebsd.org/changeset/base/354672 >> >> Log: >> ssp: rework the logic to use priority=200 on clang builds >> >> The preproc logic was added at the last minute to appease GCC 4.2, and >> kevans@ did clearly not go back and double-check that the logic worked out >> for clang builds to use the new variant. >> >> It turns out that clang defines __GNUC__ == 4. Flip it around and check >> __clang__ as well, leaving a note to remove it later. >> >> >> clang reports itself as GCC 4.2, the priority argument was introduced in >> GCC 4.3. >> >> Reported by: cem >> >> Modified: >> head/lib/libc/secure/stack_protector.c >> >> Modified: head/lib/libc/secure/stack_protector.c >> ============================================================================== >> --- head/lib/libc/secure/stack_protector.c Wed Nov 13 02:22:00 2019 (r354671) >> +++ head/lib/libc/secure/stack_protector.c Wed Nov 13 03:00:32 2019 (r354672) >> @@ -47,13 +47,15 @@ __FBSDID("$FreeBSD$"); >> * they're either not usually statically linked or they simply don't do things >> * in constructors that would be adversely affected by their positioning with >> * respect to this initialization. >> + * >> + * This conditional should be removed when GCC 4.2 is removed. >> */ >> -#if defined(__GNUC__) && __GNUC__ <= 4 >> -#define _GUARD_SETUP_CTOR_ATTR \ >> - __attribute__((__constructor__, __used__)); >> -#else >> +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) >> #define _GUARD_SETUP_CTOR_ATTR \ >> __attribute__((__constructor__ (200), __used__)); >> +#else >> +#define _GUARD_SETUP_CTOR_ATTR \ >> + __attribute__((__constructor__, __used__)); >> #endif >> >> extern int __sysctl(const int *name, u_int namelen, void *oldp, >> >> Please fix properly. Assuming clang always supported it, something like: >> >> #if __GNUC_PREREQ__(4, 3) || __has_attribute(__constructor__) >> >> should work >> >> Cheers, >> > > I considered something of this sort, but searching for information on the > priority argument in the first place was annoying enough that I had too > much search-fatigue to figure out when GCC actually corrected this, thus > assuming that GCC5 (which seemed to be an all-around good release if memory > serves) and later (since I confirmed GCC6) was sufficient. > > I'll fix it in the morning (~8 hours) if I receive no further objections > to address. > Soon enough this can be removed entirely... Getting it pedantically right in the mean time has little value. We don't really support gcc5 at the moment. gcc6 and later have good support, but anything new between 4.3 and 6.0 likely is poorly tagged... Warner