Skip to content

gh-111178: Fix getsockaddrarg() undefined behavior #131668

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

Merged
merged 12 commits into from
Apr 1, 2025

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Mar 24, 2025

Don't pass direct references to sockaddr members since their type may not match PyArg_ParseTuple() types. Instead, use temporary 'int' and 'unsigned char' variables, and update sockaddr members afterwards.

Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.
@vstinner
Copy link
Member Author

Fix the following error:

$ ./python -m test -v test_socket 
== CPython 3.14.0a6+ (heads/main:4596666a9f9, Mar 24 2025, 14:50:29) [Clang 19.1.7 (Fedora 19.1.7-2.fc41)]
== Linux-6.13.4-200.fc41.x86_64-x86_64-with-glibc2.40 little-endian
== Python build: release UBSAN
(...)
0:00:00 load avg: 3.93 [1/1] test_socket
testBindBrEdrL2capSocket (test.test_socket.BasicBluetoothTest.testBindBrEdrL2capSocket) ...

Python/getargs.c:705:13: runtime error: store to misaligned address 0x7ffc1837d0f2 for type 'int', which requires 4 byte alignment
0x7ffc1837d0f2: note: pointer points here
 00 00  1f 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  d0 d0 37 18 fc 7f 00 00  90 a6 90 01 00 00
              ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/getargs.c:705:13 

@vstinner
Copy link
Member Author

@picnixz: This change looks like a bugfix, do you think that it should be backported to 3.12 and 3.13 branches?

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

Are BTPROTO_RFCOMM and BTPROTO_HCI for non-NetBSD below also suffering from the same issue? And yes, it is a bugfix IMO even if the function is internal.

@vstinner
Copy link
Member Author

Are BTPROTO_RFCOMM and BTPROTO_HCI for non-NetBSD below also suffering from the same issue?

I didn't get UBsan warning/error on this code, so I prefer to leave it unchanged.

And yes, it is a bugfix IMO even if the function is internal.

This function is called by sock.bind(), sock.connect() and sock.sendto() for example.

@picnixz
Copy link
Member

picnixz commented Mar 24, 2025

I didn't get UBsan warning/error on this code, so I prefer to leave it unchanged.

At compile time I don't think there will be but at runtime it might be because the tests are not covering the calls

This function is called by sock.bind(), sock.connect() and sock.sendto() for example.

By internal I meant it's not documented (but yes it's called by many other functions)

@vstinner vstinner added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Mar 24, 2025
@vstinner
Copy link
Member Author

At compile time I don't think there will be but at runtime it might be because the tests are not covering the calls

I added abort() in BTPROTO_RFCOMM and BTPROTO_HCI code paths and ran test_socket. Sadly, test_socket pass with my change, which means that these two code paths are not tested by test_socket.

If it's not tested, I don't feel comfortable to modify these code paths.

@vstinner
Copy link
Member Author

On Linux, the sockaddr_l2 structure is defined as:

struct sockaddr_l2 {
	sa_family_t	l2_family;
	unsigned short	l2_psm;
	bdaddr_t	l2_bdaddr;
	unsigned short	l2_cid;
	uint8_t		l2_bdaddr_type;
};

l2_psm and l2_cid members are unsigned. So I'm not sure if my change is correct.

cc @serhiy-storchaka

@serhiy-storchaka
Copy link
Member

On common platforms int covers ranges of unsigned short, so the correct code should work. But will not there be a compiler warning when int is implicitly converted to unsigned short? So maybe use unsigned short for psm? In any case, this code is Linux-only, because on FreeBSD and NetBSD there are no cid and bdaddr_type fields.

I afraid that there is a similar error for BTPROTO_RFCOMM: on Linux, FreeBSD and NetBSD the channel field has type uint8_t, not int.

https://man.archlinux.org/man/l2cap.7.en
https://man.freebsd.org/cgi/man.cgi?query=ng_btsocket
https://man.netbsd.org/bluetooth.4

Fix also BTPROTO_RFCOMM and BTPROTO_HCI code path.
@vstinner
Copy link
Member Author

I updated my PR to use unsigned short and unsigned char, and I also updated BTPROTO_RFCOMM and BTPROTO_HCI.

@serhiy-storchaka @picnixz: Please review the updated PR.

@@ -2094,11 +2109,13 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
return 0;
#else /* __NetBSD__ || __DragonFly__ */
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
if (!PyArg_ParseTuple(args, "i", &_BT_HCI_MEMB(addr, dev))) {
unsigned short dev = _BT_HCI_MEMB(addr, dev);
Copy link
Member

Choose a reason for hiding this comment

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

Where is it defined?

Copy link
Member

@picnixz picnixz Apr 1, 2025

Choose a reason for hiding this comment

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

There's a bunch of define at the top of the file:

#if (defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H)) \
     && !defined(__NetBSD__) && !defined(__DragonFly__)
#define USE_BLUETOOTH 1
#if defined(__FreeBSD__)
...
#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb)
...
#elif defined(__NetBSD__) || defined(__DragonFly__) // <- unreachable
... 
#define _BT_HCI_MEMB(sa, memb) ((sa)->bt_##memb)
#else
...
#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb)
...
#endif
#endif

But AFAICT, the elif defined(__NetBSD__) || defined(__DragonFly__) is not possible at all since we're still in the big #if where we want !defined(__NetBSD__) && !defined(__DragonFly__). So indeed, it looks like the macro wouldn't be defined here.

I think we should remove !defined(__NetBSD__) && !defined(__DragonFly__)

Copy link
Member

Choose a reason for hiding this comment

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

I know about _BT_HCI_MEMB. I asked on what platform the *_dev member is defined, what its name and the structure name. Its turned out that it is hci_node on FreeBSD and NetBSD. hci_dev should exist on Linux.

@serhiy-storchaka serhiy-storchaka added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 29, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 18ed09e 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131668%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 29, 2025
@vstinner
Copy link
Member Author

Oh no, build fails on FreeBSD:

./Modules/socketmodule.c:2116:28: error: incompatible pointer to integer conversion initializing 'unsigned short' with an expression of type 'char[32]' [-Wint-conversion]
 2116 |             unsigned short dev = _BT_HCI_MEMB(addr, dev);
      |                            ^     ~~~~~~~~~~~~~~~~~~~~~~~
./Modules/socketmodule.c:2122:37: error: array type 'char[32]' is not assignable
 2122 |             _BT_HCI_MEMB(addr, dev) = dev;
      |             ~~~~~~~~~~~~~~~~~~~~~~~ ^

Unrelated failures.

ARM64 Windows PR and ARM64 Windows Non-Debug PR: pythoninfo steps crash with exit code -1073741819.

s390x Fedora Stable Clang PR, s390x RHEL8 PR, s390x RHEL9 PR: test_binary_header() of test_tools.test_msgfmt.CompilationTest failed. I don't know why, but it's unrelated to this change.

@picnixz
Copy link
Member

picnixz commented Mar 29, 2025

(There's an open PR fixing test_binary_header) #131879

@serhiy-storchaka
Copy link
Member

This is weird, because on FreeBSD the sockaddr_hci structure does not have the hci_dev member, it has the hci_node. But hci_dev is defined as hci_node in this file.

It is not an integer, it is a null-terminated string (size == 32 == NG_NODESIZ == HCI_DEVNAME_SIZE).

@vstinner
Copy link
Member Author

vstinner commented Apr 1, 2025

You need also to make makesockaddr consisting with the parsing code.

Alright, done.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM, except that I am not sure about exception types.

vstinner added 3 commits April 1, 2025 15:13
The socket address channel is not initialized before calling
PyArg_ParseTuple().
@vstinner vstinner enabled auto-merge (squash) April 1, 2025 13:33
@vstinner vstinner merged commit 8cd29c2 into python:main Apr 1, 2025
42 checks passed
@vstinner vstinner deleted the ubsan_test_socket2 branch April 1, 2025 13:54
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8cd29c2b533e5a1a262238695d05f2a7c44d6455 3.13

@miss-islington-app
Copy link

Sorry, @vstinner, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8cd29c2b533e5a1a262238695d05f2a7c44d6455 3.12

vstinner added a commit to vstinner/cpython that referenced this pull request Apr 1, 2025
Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.

On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.

(cherry picked from commit 8cd29c2)
@bedevere-app
Copy link

bedevere-app bot commented Apr 1, 2025

GH-131977 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Apr 1, 2025
@vstinner vstinner removed the needs backport to 3.12 only security fixes label Apr 1, 2025
@vstinner
Copy link
Member Author

vstinner commented Apr 1, 2025

Merged, thanks for reviews.

vstinner added a commit that referenced this pull request Apr 1, 2025
…131977)

gh-111178: Fix getsockaddrarg() undefined behavior (#131668)

Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.

On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.

(cherry picked from commit 8cd29c2)
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 1, 2025
…onGH-131668) (pythonGH-131977)

pythongh-111178: Fix getsockaddrarg() undefined behavior (pythonGH-131668)

Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.

On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
(cherry picked from commit c318a03)

Co-authored-by: Victor Stinner <[email protected]>
(cherry picked from commit 8cd29c2)
vstinner added a commit that referenced this pull request Apr 1, 2025
…GH-131977) (#131979)

[3.13] gh-111178: Fix getsockaddrarg() undefined behavior (GH-131668) (GH-131977)

gh-111178: Fix getsockaddrarg() undefined behavior (GH-131668)

Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.

On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
(cherry picked from commit c318a03)

Co-authored-by: Victor Stinner <[email protected]>
(cherry picked from commit 8cd29c2)

Co-authored-by: Victor Stinner <[email protected]>
@serhiy-storchaka
Copy link
Member

This PR also fixes #67632 and partially fixes #85302.

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Fedora Stable Clang Installed 3.13 (tier-2) has failed when building commit c318a03.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1387/builds/618) and take a look at the build logs.
  4. Check if the failure is related to this commit (c318a03) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1387/builds/618

Failed tests:

  • test_perf_profiler
  • test_tracemalloc

Failed subtests:

  • test_python_calls_appear_in_the_stack_if_perf_activated - test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.13/test/test_perf_profiler.py", line 356, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertIn(f"py::foo:{script}", stdout)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'py::foo:/tmp/test_python_8ytysh0g/tmp8l6ur2v9/perftest.py' not found in 'python3.13  775038 680530.621812:          1 cycles:Pu: \n\tffffaa282d37fc78 [unknown] ([unknown])\n\tffffaa282d38049c [unknown] ([unknown])\n\tffffaa282bf215e4 [unknown] ([unknown])\n\t    ffff9203cac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython3.13  775038 680530.621845:          1 cycles:Pu: \n\t    ffff9203cac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython3.13  775038 680530.622063:          1 cycles:Pu: \n\t    ffff9203df40 __fstat+0x0 (inlined)\n\t    ffff9202b70f _dl_sysdep_read_whole_file+0x4f (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff92033a0f _dl_load_cache_lookup+0x127 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff920292c3 _dl_map_object+0x377 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff920245bf openaux+0x3f (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff92023303 _dl_catch_exception+0x63 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff92024b33 _dl_map_object_deps+0x553 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff9203a19f dl_main+0x139f (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff920375ff _dl_sysdep_start+0x1df (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff92038b17 _dl_start_final+0x5ab (inlined)\n\t    ffff92038b17 _dl_start+0x5ab (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff9203cad3 _start+0x13 (/usr/lib/ld-linux-aarch64.so.1)\n\npython3.13  775038 680530.622087:        398 cycles:Pu: \n\tffffaa282d37ff10 [unknown] ([unknown])\n\tffffaa282d3804cc [unknown] ([unknown])\n\tffffaa282bf215e4 [unknown] ([unknown])\n\t    ffff9203e628 __mmap64+0x28 (inlined)\n\t    ffff9203e628 mmap64+0x28 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff9202b75b _dl_sysdep_read_whole_file+0x9b (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff92033a0f _dl_load_cache_lookup+0x127 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff920292c3 _dl_map_
home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5dbdef config_get_locale_encoding+0xf17 (inlined)\n\t          5dbdef config_init_stdio_encoding+0xf17 (inlined)\n\t          5dbdef config_read+0xf17 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5dae33 _PyConfig_Read+0xfe7 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5ef8b3 pyinit_core+0x183 (inlined)\n\t          5ef8b3 Py_InitializeFromConfig+0x183 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61daf7 pymain_init+0x10b (inlined)\n\t          61daf7 pymain_main+0x10b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61dbab Py_BytesMain+0x27 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t    ffff91dd625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffff91dd633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41daef _start+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\npython3.13  775038 680530.624223:     257882 cycles:Pu: \n\t          5eec04 _Py_HashBytes+0x4 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          536efb unicode_hash+0x5b (inlined)\n\t          536efb hashtable_unicode_hash+0x5b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5d0b87 _Py_hashtable_get_entry_generic+0x23 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5d0f6b _Py_hashtable_get+0xf (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          529083 intern_common+0xe3 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          478ddf descr_new+0x123 (inlined)\n\t          478ddf PyDescr_NewMethod+0x123 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4f3df7 type_add_method+0x33 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4f4963 type_add_methods+0x95b (inlined)\n\t          4f4963 type_ready_fill_dict+0x95b (inlined)\n\t          4f4963 type_ready+0x95b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4f623f init_static_type+0x187 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4c4677 _PyTypes_InitTypes+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f27b7 pycore_init_types+0x23 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f2623 pycore_interp_init+0x12f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f2487 pyinit_config+0x237 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5ef9df pyinit_core+0x2af (inlined)\n\t          5ef9df Py_InitializeFromConfig+0x2af (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61daf7 pymain_init+0x10b (inlined)\n\t          61daf7 pymain_main+0x10b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61dbab Py_BytesMain+0x27 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/targ


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.13/test/test_perf_profiler.py", line 356, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertIn(f"py::foo:{script}", stdout)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'py::foo:/tmp/test_python_4rqy3epg/tmp03c8mvgy/perftest.py' not found in 'python3.13  792251 680597.983070:          1 cycles:Pu: \n\t    ffffa1e6cac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython3.13  792251 680597.983090:          1 cycles:Pu: \n\t    ffffa1e6cac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython3.13  792251 680597.984079:          1 cycles:Pu: \n\t          41c790 nl_langinfo@plt+0x0 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61a00b _Py_GetLocaleEncoding+0x13 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5dae33 _PyConfig_Read+0xfe7 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5ef8b3 pyinit_core+0x183 (inlined)\n\t          5ef8b3 Py_InitializeFromConfig+0x183 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61daf7 pymain_init+0x10b (inlined)\n\t          61daf7 pymain_main+0x10b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61dbab Py_BytesMain+0x27 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t    ffffa1c0625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffffa1c0633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41daef _start+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\npython3.13  792251 680597.984100:        433 cycles:Pu: \n\t          41c300 .plt+0x10 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61a00b _Py_GetLocaleEncoding+0x13 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5dae33 _PyConfig_Read+0xfe7 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5ef8b3 pyinit_core+0x183 (inlined)\n\t          5ef8b3 Py_InitializeFromConfig+0x183 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61daf7 pymain_init+0x10b (inlined)\n\t          61daf7 pymain_main+0x10b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61dbab Py_BytesMain+0x27 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t    ffffa1c0625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffffa1c0633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41daef _start+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedo
n\t          4f623f init_static_type+0x187 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4c4677 _PyTypes_InitTypes+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f27b7 pycore_init_types+0x23 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f2623 pycore_interp_init+0x12f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f2487 pyinit_config+0x237 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5ef9df pyinit_core+0x2af (inlined)\n\t          5ef9df Py_InitializeFromConfig+0x2af (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61daf7 pymain_init+0x10b (inlined)\n\t          61daf7 pymain_main+0x10b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61dbab Py_BytesMain+0x27 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t    ffffa1c0625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffffa1c0633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41daef _start+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\npython3.13  792251 680597.985139:      48338 cycles:Pu: \n\t          5290b0 Py_INCREF+0x110 (inlined)\n\t          5290b0 _Py_NewRef+0x110 (inlined)\n\t          5290b0 intern_common+0x110 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          47982b descr_new+0x63 (inlined)\n\t          47982b PyDescr_NewWrapper+0x63 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4f4523 add_operators+0x51b (inlined)\n\t          4f4523 type_ready_fill_dict+0x51b (inlined)\n\t          4f4523 type_ready+0x51b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4f623f init_static_type+0x187 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          4c4677 _PyTypes_InitTypes+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f27b7 pycore_init_types+0x23 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f2623 pycore_interp_init+0x12f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5f2487 pyinit_config+0x237 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          5ef9df pyinit_core+0x2af (inlined)\n\t          5ef9df Py_InitializeFromConfig+0x2af (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61daf7 pymain_init+0x10b (inlined)\n\t          61daf7 pymain_main+0x10b (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t          61dbab Py_BytesMain+0x27 (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\t    ffffa1c0625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffffa1c0633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41daef _start+0x2f (/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang-installed/build/target/bin/python3.13)\n\npython3.13  792251 680597.986152:     104837 cycles:Pu: \n\t    ffffa1c8588c strncmp+0xe8 (/usr/lib64/libc.so.6)\n\t          4f4ef7 find_signature+0xeef (inlined)\n\t          4f4ef7


Traceback.test_repr) ... ok

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 FreeBSD Refleaks 3.13 (tier-3) has failed when building commit c318a03.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1615/builds/593) and take a look at the build logs.
  4. Check if the failure is related to this commit (c318a03) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1615/builds/593

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/3.13.ware-freebsd.refleak/build/Lib/test/support/__init__.py", line 812, in gc_collect
    gc.collect()
ResourceWarning: unclosed <ssl.SSLSocket fd=7, family=2, type=1, proto=0, laddr=('127.0.0.1', 61891)>
Xtest__all__ (test.test_ftplib.MiscTestCase.test__all__) ... ok


Traceback (most recent call last):
  File "/buildbot/buildarea/3.13.ware-freebsd.refleak/build/Lib/test/support/__init__.py", line 812, in gc_collect
    gc.collect()
ResourceWarning: unclosed <ssl.SSLSocket fd=6, family=2, type=1, proto=0, laddr=('127.0.0.1', 44424)>
.


Traceback (most recent call last):
  File "/buildbot/buildarea/3.13.ware-freebsd.refleak/build/Lib/test/test_ftplib.py", line 935, in tearDown
    self.server = None
ResourceWarning: unclosed <ssl.SSLSocket fd=7, family=2, type=1, proto=0, laddr=('127.0.0.1', 62999)>
k

seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.

On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants