Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Flags #71

Merged
merged 4 commits into from
Aug 18, 2022
Merged

Security Flags #71

merged 4 commits into from
Aug 18, 2022

Conversation

jandryuk
Copy link
Contributor

Build changes for enabling security flags. Goes with OpenXT/xenclient-oe#1449, but it can go in independently first.

Compiling with security flags enabled, we have the following error:
varstored-watch.c: In function 'start_varstored':
varstored-watch.c:32:5: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Werror=unused-result]

Check the asprintf return value and exit the program when it fails.

Signed-off-by: Jason Andryuk <[email protected]>
With security_flags, we have this error:

| In function 'strncpy',
|     inlined from 'acpi_events_initialize' at ../../../../../../../../openxt/xctools/xcpmd/src/acpi-events.c:597:5:
| /home/build/openxt/build/tmp-glibc/work/core2-64-oe-linux/xcpmd/0+git999-r0/recipe-sysroot/usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' output truncated before terminating nul copying 21 bytes from a string of the same length [-Werror=stringop-truncation]
|   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
|       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We need strlen + 1 to write the terminating NUL, so do that and remove
the manual '\0' assignment.

Signed-off-by: Jason Andryuk <[email protected]>
With security_flags, building qmp_helper fails with:
warning _FORTIFY_SOURCE requires compiling with optimization (-O)

Bitbake is passing in -O2, but the = assignment in the Makefile means
the passed in CFLAGS are dropped.  Change to += to let the bitbake flags
through.

Signed-off-by: Jason Andryuk <[email protected]>
With security_flags, building atapi_pt_helper fails with:
warning _FORTIFY_SOURCE requires compiling with optimization (-O)

Bitbake is passing in -O2, but the = assignment in the Makefile means
the passed in CFLAGS are dropped.  Change to += to let the bitbake flags
through.

Signed-off-by: Jason Andryuk <[email protected]>
@crogers1 crogers1 self-requested a review July 28, 2022 13:34
Copy link
Contributor

@crogers1 crogers1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crogers1 crogers1 merged commit 4ca6fd4 into OpenXT:master Aug 18, 2022
@jandryuk jandryuk deleted the sec-flags branch August 18, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants