<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/networking, branch path_search</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=path_search</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=path_search'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2024-03-03T15:10:51+00:00</updated>
<entry>
<title>tls: use C code for x86_64 sp_256_sub_8_p256_mod()</title>
<updated>2024-03-03T15:10:51+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-03-03T15:10:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=1273a1ddcab67c8ccca61c7c7c52c6049be4c336'/>
<id>urn:sha1:1273a1ddcab67c8ccca61c7c7c52c6049be4c336</id>
<content type='text'>
There's an upstream bug report:

   https://bugs.busybox.net/show_bug.cgi?id=15679

that if BusyBox is built for x86_64 with gcc and the use of OpenSSL
for wget is disabled, failures ensue.  A similar issue also affects
the busybox-w32 build with the comparable configuration.

The problem appears to be in the assembly code for the function
sp_256_sub_8_p256_mod(), as forcing the use of the provided C code
seems to fix both upstream and busybox-w32.  Since my knowledge of
x64_64 assembler is non-existent, someone else will need to determine
the actual issue.  For the moment, just avoid the faulty code.

Saves 32 bytes in the 64-bit build.

(GitHub issue #263)
</content>
</entry>
<entry>
<title>build system: avoid full rebuild when EXTRAVERSION changes</title>
<updated>2024-02-16T12:06:15+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-02-16T12:06:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=0200baa675d3b51c0f021da7728353ee7ceedba4'/>
<id>urn:sha1:0200baa675d3b51c0f021da7728353ee7ceedba4</id>
<content type='text'>
The last two commits allow EXTRAVERSION to track the current state
of a git repository.  The build system was unable to determine
which files were affected by changes to EXTRAVERSION and caused
a full rebuild when it changed.

Alter how the version information is passed to the code so only
a handful of files need to be rebuilt when it changes.
</content>
</entry>
<entry>
<title>httpd: enable interpreter script feature</title>
<updated>2024-02-11T11:54:16+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-02-11T11:54:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=58627310e90247040894d3aeab2fc79bcced11be'/>
<id>urn:sha1:58627310e90247040894d3aeab2fc79bcced11be</id>
<content type='text'>
The web server in BusyBox has an optional feature to allow pages
with a given suffix to be processed by a script interpreter: PHP,
for example.

Enable this in the busybox-w32 build.

Costs 256-320 bytes.

(GitHub issue #266)
</content>
</entry>
<entry>
<title>httpd: code shrink</title>
<updated>2024-02-11T10:32:08+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-02-11T10:32:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=5809565f70bd51451ef51da7dfc33716458abec3'/>
<id>urn:sha1:5809565f70bd51451ef51da7dfc33716458abec3</id>
<content type='text'>
When setting up the arguments for the CGI handler:

- Use '-I0' rather than two separate arguments.

- Use memcpy() to copy the server arguments.

Saves 32 bytes.
</content>
</entry>
<entry>
<title>httpd: avoid unnecessary process creation</title>
<updated>2024-02-09T11:16:13+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-02-09T11:16:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=5604ec323049c89b09ec7b5f4c816ab659e25dfc'/>
<id>urn:sha1:5604ec323049c89b09ec7b5f4c816ab659e25dfc</id>
<content type='text'>
The httpd server made unnecessary calls to detach from the console.
Avoiding this saves one process creation when a file is being
served and two for a CGI script.

Then again, commit ad4bd5bbd (win32: avoid console windows from CGI
scripts) results in a console host always being created for a CGI
script even if it turns out to be unnecessary.  So the net saving
is only one process for CGI scripts.
</content>
</entry>
<entry>
<title>httpd: enable support for CGI</title>
<updated>2023-12-20T13:59:17+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-12-20T13:45:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=8d85a4a5be88931978fad594b94e762313d37afc'/>
<id>urn:sha1:8d85a4a5be88931978fad594b94e762313d37afc</id>
<content type='text'>
The upstream code uses fork/exec when running a CGI process.
Emulate this by:

- Spawning a child httpd process with the special '-I 0' option,
  along with the options provided on the server command line.  This
  sets up the proper state then calls the cgi_handler() function.

- The cgi_handler() function fixes the pipe file descriptors and
  starts another child process to run the CGI script.

These processes are detached from the console on creation.  When
spawn() functions are run in P_DETACH mode they don't connect to
the standard file descriptors.  Normally this doesn't matter but
the process which runs the CGI scripts needs to inherit the pipe
endpoints.  The create_detached_process() function handles this.
See:

  https://github.com/rprichard/win32-console-docs/blob/master/README.md

Adds about 2.9Kb to the size of the binary.

(GitHub issue #266)
</content>
</entry>
<entry>
<title>httpd: fix return code when run in background</title>
<updated>2023-12-15T11:55:30+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-12-15T11:55:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=ba7d37766ec090e87a6a9cc3af685521390c6c6d'/>
<id>urn:sha1:ba7d37766ec090e87a6a9cc3af685521390c6c6d</id>
<content type='text'>
When httpd was run in the background the return code of the parent
process was incorrect.  It seems when spawn() is run in _P_DETACH
mode it returns 0 on success, not a process handle.

Fix the test for the return code and alter mingw_spawn_detach()
so it doesn't treat the return from spawn() as a handle.

Saves 32 bytes.
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2023-12-05T07:44:02+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-12-05T07:44:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=7dff7f37600209353cf4e86d1cca29bacf5f7372'/>
<id>urn:sha1:7dff7f37600209353cf4e86d1cca29bacf5f7372</id>
<content type='text'>
</content>
</entry>
<entry>
<title>win32: only search PATH for compressor</title>
<updated>2023-11-14T11:15:02+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2023-11-14T11:15:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=f444dc586b16c104a82d201d3a7caca68affe51b'/>
<id>urn:sha1:f444dc586b16c104a82d201d3a7caca68affe51b</id>
<content type='text'>
mingw_fork_compressor() uses CreateProcess() to run the compressor
program.  This will often be an instance of BusyBox, but since the
xv and lzma applets in BusyBox don't support compression it can be
an external program.

It was intended that the external program should be found using PATH.
However, CreateProcess() looks in various other places before trying
PATH.  In particular, it first looks in the directory of the current
executable, then in the current directory of the process.  This can
result in the wrong xz.exe or lzma.exe being found.

Perform an explicit PATH search and force CreateProcess() to use the
result.

This change only affects the search for a compressor.  The same
problem also affects other uses of our popen(3) emulation.  These
may be addressed in future.

Costs 64-80 bytes.

(GitHub issue #376)
</content>
</entry>
<entry>
<title>udhcp: Avoid leaking uninitialized/stale data</title>
<updated>2023-10-04T14:46:35+00:00</updated>
<author>
<name>Russ Dill</name>
<email>russ.dill@gmail.com</email>
</author>
<published>2023-10-02T19:34:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=e265c8d4c039729f2a68f3b1fb589c13c38d86f8'/>
<id>urn:sha1:e265c8d4c039729f2a68f3b1fb589c13c38d86f8</id>
<content type='text'>
I noticed a commit in connman:

"gdhcp: Avoid leaking stack data via unitiialized variable" [1]

Since gdhcp is just BusyBox udhcp with the serial numbers filed off, I
checked if BusyBox udhcp has a related issue.

The issue is that the get_option logic assumes any data within the
memory area of the buffer is "valid". This reduces the complexity of the
function at the cost of reading past the end of the actually received
data in the case of specially crafted packets. This is not a problem
for the udhcp_recv_kernel_packet data path as the entire memory
area is zeroed. However, d4/d6_recv_raw_packet does not zero the
memory.

Note that a related commit [2] is not required as we are zeroing
any data that can be read by the get_option function.

[1] https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=a74524b3e3fad81b0fd1084ffdf9f2ea469cd9b1
[2] https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=58d397ba74873384aee449690a9070bacd5676fa

function                                             old     new   delta
d4_recv_raw_packet                                   484     497     +13
d6_recv_raw_packet                                   216     228     +12
.rodata                                           105390  105381      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 25/-9)              Total: 16 bytes

Signed-off-by: Russ Dill &lt;russ.dill@gmail.com&gt;
Cc: Colin Wee &lt;cwee@tesla.com&gt;
Cc: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
</feed>
