Add 3 optional features that are currently used and distributed in
the Fedora packages to the default build configuration.
The additional build time is minimal, and it ensures that the build
gets maximum coverage.
---
bootstrap-configure | 3 +++
1 file changed, 3 insertions(+)
diff --git a/bootstrap-configure b/bootstrap-configure
index cc44ae74f..2d6231f39 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -26,4 +26,7 @@ fi
--enable-mesh \
--enable-btpclient \
--enable-logger \
+ --enable-pie \
+ --enable-cups \
+ --enable-library \
--disable-datafiles $*
--
2.21.0
From: Florian Weimer <[email protected]>
Partial RELRO means that the object is GNU_RELRO but not BIND_NOW. This
reduces the effectiveness of RELRO. bluez triggers this because it
enables PIE during the build, and rpmdiff takes this as an indicator
that the best possible hardening is desired.
https://bugzilla.redhat.com/show_bug.cgi?id=983161
---
acinclude.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 7f494cc9d..6ae34b8ae 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -50,7 +50,7 @@ AC_DEFUN([MISC_FLAGS], [
if (test "${enableval}" = "yes" &&
test "${ac_cv_prog_cc_pie}" = "yes"); then
misc_cflags="$misc_cflags -fPIC"
- misc_ldflags="$misc_ldflags -pie"
+ misc_ldflags="$misc_ldflags -pie -Wl,-z,now"
fi
])
if (test "$enable_coverage" = "yes"); then
--
2.21.0
obexd/plugins/bluetooth.c: In function 'register_profile':
obexd/plugins/bluetooth.c:310:7: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
profile->driver->port);
^~~~~~~
obexd/plugins/bluetooth.c:314:7: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
profile->driver->name);
^~~~~~~
---
obexd/plugins/bluetooth.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index ba1e0a99a..57c112661 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -271,6 +271,9 @@ static int register_profile(struct bluetooth_profile *profile)
&opt);
g_dbus_dict_append_entry(&opt, "AutoConnect", DBUS_TYPE_BOOLEAN,
&auto_connect);
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
if (profile->driver->record) {
if (profile->driver->port != 0)
xml = g_markup_printf_escaped(profile->driver->record,
@@ -281,6 +284,7 @@ static int register_profile(struct bluetooth_profile *profile)
xml = g_markup_printf_escaped(profile->driver->record,
profile->driver->channel,
profile->driver->name);
+#pragma GCC diagnostic pop
g_dbus_dict_append_entry(&opt, "ServiceRecord",
DBUS_TYPE_STRING, &xml);
g_free(xml);
--
2.21.0
android/avrcp-lib.c: In function ‘get_element_attributes’:
android/avrcp-lib.c:967:24: error: taking address of packed member of ‘struct get_element_attributes_req’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
967 | if (!parse_attributes(* (&req->attrs), params_len - sizeof(*req),
| ^~~~~~~~~~~~~~~
---
android/avrcp-lib.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 2c874952c..21d01955d 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -927,14 +927,15 @@ static ssize_t get_play_status(struct avrcp *session, uint8_t transaction,
player->user_data);
}
-static bool parse_attributes(uint32_t *params, uint16_t params_len,
- uint8_t number, uint32_t *attrs)
+static bool parse_attributes(struct get_element_attributes_req *req,
+ uint16_t params_len, uint8_t number,
+ uint32_t *attrs)
{
int i;
for (i = 0; i < number && params_len >= sizeof(*attrs); i++,
params_len -= sizeof(*attrs)) {
- attrs[i] = be32_to_cpu(params[i]);
+ attrs[i] = be32_to_cpu(req->attrs[i]);
if (attrs[i] == AVRCP_MEDIA_ATTRIBUTE_ILLEGAL ||
attrs[i] > AVRCP_MEDIA_ATTRIBUTE_LAST)
@@ -964,7 +965,7 @@ static ssize_t get_element_attributes(struct avrcp *session,
if (!params || params_len < sizeof(*req))
return -EINVAL;
- if (!parse_attributes(req->attrs, params_len - sizeof(*req),
+ if (!parse_attributes(req, params_len - sizeof(*req),
req->number, attrs))
return -EINVAL;
--
2.21.0
---
acinclude.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 045138c04..7f494cc9d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -21,7 +21,7 @@ AC_DEFUN([COMPILER_FLAGS], [
with_cflags="$with_cflags -Wredundant-decls"
with_cflags="$with_cflags -Wcast-align"
with_cflags="$with_cflags -Wswitch-enum"
- with_cflags="$with_cflags -Wformat -Wformat-security"
+ with_cflags="$with_cflags -Wformat -Wformat-security -Wformat-nonliteral"
with_cflags="$with_cflags -DG_DISABLE_DEPRECATED"
with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
--
2.21.0
android/handsfree.c: In function ‘bt_sco_get_fd’:
android/handsfree.c:2913:47: error: taking address of packed member of ‘struct sco_rsp_get_fd’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
2913 | if (!dev || !bt_sco_get_fd_and_mtu(sco, &fd, &rsp.mtu))
| ^~~~~~~~
---
android/handsfree.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/android/handsfree.c b/android/handsfree.c
index cb348ab9f..ebe03728e 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -2903,6 +2903,7 @@ static void bt_sco_get_fd(const void *buf, uint16_t len)
struct sco_rsp_get_fd rsp;
struct hf_device *dev;
bdaddr_t bdaddr;
+ uint16_t mtu;
int fd;
DBG("");
@@ -2910,9 +2911,10 @@ static void bt_sco_get_fd(const void *buf, uint16_t len)
android2bdaddr(cmd->bdaddr, &bdaddr);
dev = find_device(&bdaddr);
- if (!dev || !bt_sco_get_fd_and_mtu(sco, &fd, &rsp.mtu))
+ if (!dev || !bt_sco_get_fd_and_mtu(sco, &fd, &mtu))
goto failed;
+ rsp.mtu = mtu;
DBG("fd %d mtu %u", fd, rsp.mtu);
ipc_send_rsp_full(sco_ipc, SCO_SERVICE_ID, SCO_OP_GET_FD,
--
2.21.0
GCC's "format-nonliteral" security check is enabled as an error in
recent versions of Fedora. Given the limited formats, pass a boolean
to switch between the 2 different formats.
tools/csr_usb.c: In function 'read_value':
tools/csr_usb.c:82:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
n = fscanf(file, format, &value);
^
---
tools/csr_usb.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/tools/csr_usb.c b/tools/csr_usb.c
index f3ab2ddce..32fdf1f14 100644
--- a/tools/csr_usb.c
+++ b/tools/csr_usb.c
@@ -32,6 +32,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
#include <dirent.h>
#include <limits.h>
@@ -68,7 +69,7 @@ struct usbfs_bulktransfer {
#define USBFS_IOCTL_CLAIMINTF _IOR('U', 15, unsigned int)
#define USBFS_IOCTL_RELEASEINTF _IOR('U', 16, unsigned int)
-static int read_value(const char *name, const char *attr, const char *format)
+static int read_value(const char *name, const char *attr, bool hex_number)
{
char path[PATH_MAX];
FILE *file;
@@ -80,7 +81,7 @@ static int read_value(const char *name, const char *attr, const char *format)
if (!file)
return -1;
- n = fscanf(file, format, &value);
+ n = fscanf(file, hex_number ? "%d" : "%04x", &value);
if (n != 1) {
fclose(file);
return -1;
@@ -90,26 +91,29 @@ static int read_value(const char *name, const char *attr, const char *format)
return value;
}
+#define read_hex_value(name, file) read_value((name), (file), true)
+#define read_num_value(name, file) read_value((name), (file), false)
+
static char *check_device(const char *name)
{
char path[PATH_MAX];
int busnum, devnum, vendor, product;
- busnum = read_value(name, "busnum", "%d");
+ busnum = read_num_value(name, "busnum");
if (busnum < 0)
return NULL;
- devnum = read_value(name, "devnum", "%d");
+ devnum = read_num_value(name, "devnum");
if (devnum < 0)
return NULL;
snprintf(path, sizeof(path), "/dev/bus/usb/%03u/%03u", busnum, devnum);
- vendor = read_value(name, "idVendor", "%04x");
+ vendor = read_hex_value(name, "idVendor");
if (vendor < 0)
return NULL;
- product = read_value(name, "idProduct", "%04x");
+ product = read_hex_value(name, "idProduct");
if (product < 0)
return NULL;
--
2.21.0
android/hal-bluetooth.c: In function ‘set_adapter_property’:
android/hal-bluetooth.c:659:46: error: taking address of packed member of ‘struct hal_cmd_set_adapter_prop’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
659 | adapter_prop_from_hal(property, &cmd->type, &cmd->len, cmd->val);
| ^~~~~~~~~
---
android/hal-bluetooth.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index f22801b04..ee3a5e054 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -649,6 +649,7 @@ static int set_adapter_property(const bt_property_t *property)
{
char buf[IPC_MTU];
struct hal_cmd_set_adapter_prop *cmd = (void *) buf;
+ uint16_t len_ret;
size_t len;
DBG("prop: %s", btproperty2str(property));
@@ -656,8 +657,9 @@ static int set_adapter_property(const bt_property_t *property)
if (!interface_ready())
return BT_STATUS_NOT_READY;
- adapter_prop_from_hal(property, &cmd->type, &cmd->len, cmd->val);
+ adapter_prop_from_hal(property, &cmd->type, &len_ret, cmd->val);
+ cmd->len = len_ret;
len = sizeof(*cmd) + cmd->len;
return hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_SET_ADAPTER_PROP,
--
2.21.0
Hi Bastien,
On Thu, May 9, 2019 at 3:40 PM Bastien Nocera <[email protected]> wrote:
>
> Add 3 optional features that are currently used and distributed in
> the Fedora packages to the default build configuration.
>
> The additional build time is minimal, and it ensures that the build
> gets maximum coverage.
> ---
> bootstrap-configure | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/bootstrap-configure b/bootstrap-configure
> index cc44ae74f..2d6231f39 100755
> --- a/bootstrap-configure
> +++ b/bootstrap-configure
> @@ -26,4 +26,7 @@ fi
> --enable-mesh \
> --enable-btpclient \
> --enable-logger \
> + --enable-pie \
> + --enable-cups \
> + --enable-library \
> --disable-datafiles $*
> --
> 2.21.0
Applied, thanks. I skipped patches 2 and 5 since I want to check what
can be done regarding of usage of pragma.
--
Luiz Augusto von Dentz
On Mon, 2019-05-13 at 20:38 +0300, Luiz Augusto von Dentz wrote:
> Applied, thanks. I skipped patches 2 and 5 since I want to check what
> can be done regarding of usage of pragma.
Thanks for applying those.
Cheers