From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19364 invoked from network); 29 Dec 2020 01:27:18 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 29 Dec 2020 01:27:18 -0000 Received: (qmail 29916 invoked by uid 550); 29 Dec 2020 01:27:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 29898 invoked from network); 29 Dec 2020 01:27:09 -0000 Date: Mon, 28 Dec 2020 20:26:56 -0500 From: Rich Felker To: Shiz Cc: musl@lists.openwall.com, darkkirb@darkkirb.be Message-ID: <20201229012656.GE22981@brightrain.aerifal.cx> References: <6106be97-2c82-75c0-ad88-2e49b17c68ee@darkkirb.de> <20201227230554.ddflrnbmyvjccj4n@gmail.com> <20201228005632.rezxjuehsgmr5ira@gmail.com> <0326d35a-4c1d-3d25-1917-166e5b580062@darkkirb.de> <865734a3-e4c6-eb06-5855-db74c00fb071@darkkirb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH] Add support for LLVM's Control Flow Integrity (V2) On Mon, Dec 28, 2020 at 06:01:45PM +0100, Shiz wrote: > Hi, > > It seems to me guarding all of those with #ifdef __clang__ is not the optimal approach. > What if another compilers decides to pick up the spec, or an older non-CFI > Clang is used to compile? I think it's more logical to check the no_sanitize attribute > with a functional test (like __has_attribute), and to just apply the used attribute > unconditionally. Regardless none of these changes belong in source files. Assuming it actually can be made to work to begin with, the nocfi stuff should be done on a file-granularity basis with per-target CFLAGS += ... The "used" attributes are working around some other problem, either a bug in clang (sounds most likely) or lack of semantic usedness in musl source, and should be fixed wherever the bug is not papered over. Rich