From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Sadovsky Date: Thu, 14 Jan 2021 17:59:52 +0300 Subject: [PATCH v7] Add support for stack-protector In-Reply-To: <20210114135918.141419-1-joel.peshkin@broadcom.com> References: <20210110153900.19429-1-joel.peshkin@broadcom.com> <20210114135918.141419-1-joel.peshkin@broadcom.com> Message-ID: <7afd867f-4f45-ec68-404e-cda72add4b56@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Joel, > Add support for stack protector for UBOOT, SPL, and TPL > as well as new pytest for stackprotector > > Signed-off-by: Joel Peshkin > Cc: Simon Glass > Cc: Heinrich Schuchardt > > Changes for v7: >??? - Fix commit message >??? - add __builtin_extract_return_addr() calls > Changes for v6: >??? - Fix commit message > Changes for v5: >??? - Rebase > Changes for v4: >??? - Exclude EFI from stackprotector >??? - Cleanups of extra includes and declaration > Changes for v3: >??? - Move test command to cmd/ >??? - Update Kconfig names and depends >??? - clean up default canary initialization > Changes for v2: >??? - Add test command and corresponding config >??? - Fixed incorrect description in Kconfig >??? - Add unit test > --- > --- Patch changelog is not a part of commit message, it's placed below the '---' mark. I hope this guide will help you: https://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions > [...] > +DECLARE_GLOBAL_DATA_PTR; > + > +unsigned long __stack_chk_guard = (long)(0xfeedf00ddeadbeef & ~0L); 'long' and 'unsigned long' are slightly different types. I suggest you the following form (please, note the UL instead of L): unsigned long __stack_chk_guard = (unsigned long)(0xfeedf00ddeadbeef & ~0UL) Else gcc will complain like this: > warning: unsigned conversion from ?long int? to ?long long unsigned int? changes value from ?-1? to ?18446744073709551615? [-Wsign-conversion] > unsigned long __stack_chk_guard = (long)(0xfeedf00ddeadbeef & ~0L); > warning: unsigned conversion from ?long int? to ?long unsigned int? changes value from ?-559038737? to ?3735928559? [-Wsign-conversion] I hope you'll find -Wconversion compiler flag useful, it's one of the flags that often help me to spot some corner cases with potential bugs. IMHO it should be enabled by default.