mbox series

[SRU,N/J,0/1] Fix L2CAP/LE/CPU/BI-02-C bluetooth certification failure

Message ID 20240723035203.7260-1-leo.lin@canonical.com
Headers show
Series Fix L2CAP/LE/CPU/BI-02-C bluetooth certification failure | expand

Message

Leo Lin July 23, 2024, 3:52 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2072858

[Impact]

Noble failed the L2CAP/LE/CPU/BI-02-C test in the Porfile Tuning Suite (PTS), 
which Jammy previously could pass.

This is due to new behavior introduced in e4b019515f950b4e6e5b74b2e1bb03a90cb33039.
(Bluetooth: Enforce validation on max value of connection interval). The kernel
only accept Connection Parameter Update Requests whose incoming conn_max_interval
are lower than the current conn_max_interval, and adjust the newer
conn_max_interval to that received max value.

However, this behavior means that conn_max_interval can only decrease, but never
increase. This could potentially make the conditions for connection parameters
narrower over time, causing subsequent connections failed on some devices.
See the issue 847 in bluez upstream[1]. The patch 806a5198c05987b748b50f3d0c0cfb3d417381a4
(Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ) in the linux-next
fixed this by accepting connection parameter unconditionally. The relavent test
procedure is also on the mailing list[2].

[1] https://github.com/bluez/bluez/issues/847
[2] https://linuxlists.cc/l/15/linux-bluetooth/t/5350289/(patch_v3)_bluetooth:_l2cap:_fix_rejecting_l2cap_conn_param_update_req#post5352326

[Fix]
Backport the from commit 806a5198c05987b748b50f3d0c0cfb3d417381a4
(Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ), which
already in the linux-next.

[1] https://patchwork.kernel.org/project/bluetooth/patch/20240521143521.1568672-1-luiz.dentz@gmail.com/

[Test Case]
1. Install the kernel with the backported patch
2. Run the following test case in the PTS:
 L2CAP/LE/CPU/BI-02-C
 GAP/CONN/CPUP/BV-05-C

[Where problems could occur]
This essentially revert the behavior of accepting L2CAP connection parameters
back to its original state before e4b019515f950b4e6e5b74b2e1bb03a90cb33039
(Bluetooth: Enforce validation on max value of connection interval).

Note that implementing restriction to the conenction parameters may take greater
effort than just adding a few checks in the kernel. The user space, notably the
bluetoothd may also need adjustments[1]. So in this case, removing the half-done
boundary checks in kernel may still do greater good if there's no plan to make
those additional changes.

[1] https://github.com/bluez/bluez/issues/717#issuecomment-1885719058

Luiz Augusto von Dentz (1):
  Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ

 include/net/bluetooth/hci_core.h | 36 ++++++++++++++++++++++++++++----
 net/bluetooth/l2cap_core.c       |  8 +------
 2 files changed, 33 insertions(+), 11 deletions(-)

Comments

Noah Wager July 23, 2024, 5:06 a.m. UTC | #1
On Tue, Jul 23, 2024 at 11:52:02AM +0800, Yo-Jung (Leo) Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/2072858
> 
> [Impact]
> 
> Noble failed the L2CAP/LE/CPU/BI-02-C test in the Porfile Tuning Suite (PTS), 
> which Jammy previously could pass.
> 
> This is due to new behavior introduced in e4b019515f950b4e6e5b74b2e1bb03a90cb33039.
> (Bluetooth: Enforce validation on max value of connection interval). The kernel
> only accept Connection Parameter Update Requests whose incoming conn_max_interval
> are lower than the current conn_max_interval, and adjust the newer
> conn_max_interval to that received max value.
> 
> However, this behavior means that conn_max_interval can only decrease, but never
> increase. This could potentially make the conditions for connection parameters
> narrower over time, causing subsequent connections failed on some devices.
> See the issue 847 in bluez upstream[1]. The patch 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ) in the linux-next
> fixed this by accepting connection parameter unconditionally. The relavent test
> procedure is also on the mailing list[2].
> 
> [1] https://github.com/bluez/bluez/issues/847
> [2] https://linuxlists.cc/l/15/linux-bluetooth/t/5350289/(patch_v3)_bluetooth:_l2cap:_fix_rejecting_l2cap_conn_param_update_req#post5352326
> 
> [Fix]
> Backport the from commit 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ), which
> already in the linux-next.
> 
> [1] https://patchwork.kernel.org/project/bluetooth/patch/20240521143521.1568672-1-luiz.dentz@gmail.com/
> 
> [Test Case]
> 1. Install the kernel with the backported patch
> 2. Run the following test case in the PTS:
>  L2CAP/LE/CPU/BI-02-C
>  GAP/CONN/CPUP/BV-05-C
> 
> [Where problems could occur]
> This essentially revert the behavior of accepting L2CAP connection parameters
> back to its original state before e4b019515f950b4e6e5b74b2e1bb03a90cb33039
> (Bluetooth: Enforce validation on max value of connection interval).
> 
> Note that implementing restriction to the conenction parameters may take greater
> effort than just adding a few checks in the kernel. The user space, notably the
> bluetoothd may also need adjustments[1]. So in this case, removing the half-done
> boundary checks in kernel may still do greater good if there's no plan to make
> those additional changes.
> 
> [1] https://github.com/bluez/bluez/issues/717#issuecomment-1885719058
> 
> Luiz Augusto von Dentz (1):
>   Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
> 
>  include/net/bluetooth/hci_core.h | 36 ++++++++++++++++++++++++++++----
>  net/bluetooth/l2cap_core.c       |  8 +------
>  2 files changed, 33 insertions(+), 11 deletions(-)
> 
> -- 
> 2.34.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Noah Wager <noah.wager@canonical.com>
Manuel Diewald July 24, 2024, 8:50 a.m. UTC | #2
On Tue, Jul 23, 2024 at 11:52:02AM +0800, Yo-Jung (Leo) Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/2072858
> 
> [Impact]
> 
> Noble failed the L2CAP/LE/CPU/BI-02-C test in the Porfile Tuning Suite (PTS), 
> which Jammy previously could pass.
> 
> This is due to new behavior introduced in e4b019515f950b4e6e5b74b2e1bb03a90cb33039.
> (Bluetooth: Enforce validation on max value of connection interval). The kernel
> only accept Connection Parameter Update Requests whose incoming conn_max_interval
> are lower than the current conn_max_interval, and adjust the newer
> conn_max_interval to that received max value.
> 
> However, this behavior means that conn_max_interval can only decrease, but never
> increase. This could potentially make the conditions for connection parameters
> narrower over time, causing subsequent connections failed on some devices.
> See the issue 847 in bluez upstream[1]. The patch 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ) in the linux-next
> fixed this by accepting connection parameter unconditionally. The relavent test
> procedure is also on the mailing list[2].
> 
> [1] https://github.com/bluez/bluez/issues/847
> [2] https://linuxlists.cc/l/15/linux-bluetooth/t/5350289/(patch_v3)_bluetooth:_l2cap:_fix_rejecting_l2cap_conn_param_update_req#post5352326
> 
> [Fix]
> Backport the from commit 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ), which
> already in the linux-next.
> 
> [1] https://patchwork.kernel.org/project/bluetooth/patch/20240521143521.1568672-1-luiz.dentz@gmail.com/
> 
> [Test Case]
> 1. Install the kernel with the backported patch
> 2. Run the following test case in the PTS:
>  L2CAP/LE/CPU/BI-02-C
>  GAP/CONN/CPUP/BV-05-C
> 
> [Where problems could occur]
> This essentially revert the behavior of accepting L2CAP connection parameters
> back to its original state before e4b019515f950b4e6e5b74b2e1bb03a90cb33039
> (Bluetooth: Enforce validation on max value of connection interval).
> 
> Note that implementing restriction to the conenction parameters may take greater
> effort than just adding a few checks in the kernel. The user space, notably the
> bluetoothd may also need adjustments[1]. So in this case, removing the half-done
> boundary checks in kernel may still do greater good if there's no plan to make
> those additional changes.
> 
> [1] https://github.com/bluez/bluez/issues/717#issuecomment-1885719058
> 
> Luiz Augusto von Dentz (1):
>   Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
> 
>  include/net/bluetooth/hci_core.h | 36 ++++++++++++++++++++++++++++----
>  net/bluetooth/l2cap_core.c       |  8 +------
>  2 files changed, 33 insertions(+), 11 deletions(-)
> 
> -- 
> 2.34.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Manuel Diewald <manuel.diewald@canonical.com>
Kevin Becker July 24, 2024, 4:50 p.m. UTC | #3
On Mon, Jul 22, 2024 at 11:52 PM Yo-Jung (Leo) Lin
<leo.lin@canonical.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/2072858
>
> [Impact]
>
> Noble failed the L2CAP/LE/CPU/BI-02-C test in the Porfile Tuning Suite (PTS),
> which Jammy previously could pass.
>
> This is due to new behavior introduced in e4b019515f950b4e6e5b74b2e1bb03a90cb33039.
> (Bluetooth: Enforce validation on max value of connection interval). The kernel
> only accept Connection Parameter Update Requests whose incoming conn_max_interval
> are lower than the current conn_max_interval, and adjust the newer
> conn_max_interval to that received max value.
>
> However, this behavior means that conn_max_interval can only decrease, but never
> increase. This could potentially make the conditions for connection parameters
> narrower over time, causing subsequent connections failed on some devices.
> See the issue 847 in bluez upstream[1]. The patch 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ) in the linux-next
> fixed this by accepting connection parameter unconditionally. The relavent test
> procedure is also on the mailing list[2].
>
> [1] https://github.com/bluez/bluez/issues/847
> [2] https://linuxlists.cc/l/15/linux-bluetooth/t/5350289/(patch_v3)_bluetooth:_l2cap:_fix_rejecting_l2cap_conn_param_update_req#post5352326
>
> [Fix]
> Backport the from commit 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ), which
> already in the linux-next.
>
> [1] https://patchwork.kernel.org/project/bluetooth/patch/20240521143521.1568672-1-luiz.dentz@gmail.com/
>
> [Test Case]
> 1. Install the kernel with the backported patch
> 2. Run the following test case in the PTS:
>  L2CAP/LE/CPU/BI-02-C
>  GAP/CONN/CPUP/BV-05-C
>
> [Where problems could occur]
> This essentially revert the behavior of accepting L2CAP connection parameters
> back to its original state before e4b019515f950b4e6e5b74b2e1bb03a90cb33039
> (Bluetooth: Enforce validation on max value of connection interval).
>
> Note that implementing restriction to the conenction parameters may take greater
> effort than just adding a few checks in the kernel. The user space, notably the
> bluetoothd may also need adjustments[1]. So in this case, removing the half-done
> boundary checks in kernel may still do greater good if there's no plan to make
> those additional changes.
>
> [1] https://github.com/bluez/bluez/issues/717#issuecomment-1885719058
>
> Luiz Augusto von Dentz (1):
>   Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
>
>  include/net/bluetooth/hci_core.h | 36 ++++++++++++++++++++++++++++----
>  net/bluetooth/l2cap_core.c       |  8 +------
>  2 files changed, 33 insertions(+), 11 deletions(-)
>
> --

Acked-by: Kevin Becker <kevin.becker@canonical.com>
Roxana Nicolescu July 26, 2024, 9:59 a.m. UTC | #4
On 23/07/2024 05:52, Yo-Jung (Leo) Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/2072858
>
> [Impact]
>
> Noble failed the L2CAP/LE/CPU/BI-02-C test in the Porfile Tuning Suite (PTS),
> which Jammy previously could pass.
>
> This is due to new behavior introduced in e4b019515f950b4e6e5b74b2e1bb03a90cb33039.
> (Bluetooth: Enforce validation on max value of connection interval). The kernel
> only accept Connection Parameter Update Requests whose incoming conn_max_interval
> are lower than the current conn_max_interval, and adjust the newer
> conn_max_interval to that received max value.
>
> However, this behavior means that conn_max_interval can only decrease, but never
> increase. This could potentially make the conditions for connection parameters
> narrower over time, causing subsequent connections failed on some devices.
> See the issue 847 in bluez upstream[1]. The patch 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ) in the linux-next
> fixed this by accepting connection parameter unconditionally. The relavent test
> procedure is also on the mailing list[2].
>
> [1] https://github.com/bluez/bluez/issues/847
> [2] https://linuxlists.cc/l/15/linux-bluetooth/t/5350289/(patch_v3)_bluetooth:_l2cap:_fix_rejecting_l2cap_conn_param_update_req#post5352326
>
> [Fix]
> Backport the from commit 806a5198c05987b748b50f3d0c0cfb3d417381a4
> (Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ), which
> already in the linux-next.
>
> [1] https://patchwork.kernel.org/project/bluetooth/patch/20240521143521.1568672-1-luiz.dentz@gmail.com/
>
> [Test Case]
> 1. Install the kernel with the backported patch
> 2. Run the following test case in the PTS:
>   L2CAP/LE/CPU/BI-02-C
>   GAP/CONN/CPUP/BV-05-C
>
> [Where problems could occur]
> This essentially revert the behavior of accepting L2CAP connection parameters
> back to its original state before e4b019515f950b4e6e5b74b2e1bb03a90cb33039
> (Bluetooth: Enforce validation on max value of connection interval).
>
> Note that implementing restriction to the conenction parameters may take greater
> effort than just adding a few checks in the kernel. The user space, notably the
> bluetoothd may also need adjustments[1]. So in this case, removing the half-done
> boundary checks in kernel may still do greater good if there's no plan to make
> those additional changes.
>
> [1] https://github.com/bluez/bluez/issues/717#issuecomment-1885719058
>
> Luiz Augusto von Dentz (1):
>    Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
>
>   include/net/bluetooth/hci_core.h | 36 ++++++++++++++++++++++++++++----
>   net/bluetooth/l2cap_core.c       |  8 +------
>   2 files changed, 33 insertions(+), 11 deletions(-)
>
They were already applied from upstream stable, but I included the 
buglinks to keep track of this bug in launchpad.