kernel: HTTPS through wget, half-close, and /proc/<pid>/fd
busybox wget hands TLS to ssl_client over a socketpair and then does shutdown(SHUT_WR). That cut the AF_UNIX link both ways, so ssl_client's reply was a SIGPIPE and every https:// download hung. SHUT_WR is now a half-close: the peer reads EOF and can still answer. TCP sockets get shutdown() at all (tcp_shutdown for the FIN); it used to do nothing. - exec keeps ignored signals and the signal mask, as execve(2) says. - /proc/<pid>/fd: a link per descriptor -- the path it was opened by, socket:[n], pipe:[n], anon_inode:[eventpoll]. /proc/self too. The global inode bit moves above pid << 8; at 0x10000 it was /proc/256. - fstat on a socket or pipe answers S_IFSOCK / S_IFIFO instead of EINVAL. - poll, select and epoll wake as soon as a pipe, socket or input device changes, not on the next tick. - Pipes are 64 KB of lazily allocated pages, copied in blocks, with PIPE_BUF atomicity: 300 MB through `yes | head | wc` in 7 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
906318f2b6
commit
8351e0323b
15 changed files with 434 additions and 71 deletions
|
|
@ -534,6 +534,11 @@ int inet_sendto(void *h, char *buf, int n,
|
|||
uint addr, ushort port);
|
||||
int inet_readable(void *h);
|
||||
int inet_hup(void *h);
|
||||
int inet_shutdown(void *h, int how);
|
||||
int file_describe(struct file *f, char *buf, int cap);
|
||||
int proc_fd_mask(int pid, uint64 mask[2]);
|
||||
int proc_fd_link(int pid, int fd, char *buf, int cap);
|
||||
const char *ev_kind_name(struct evobj *o);
|
||||
void inet_close(void *h);
|
||||
|
||||
// proc.c
|
||||
|
|
@ -552,6 +557,8 @@ int sigsend(int pid, int sig);
|
|||
void alarm_arm(struct proc *p, uint after, uint every);
|
||||
uint alarm_left(struct proc *p);
|
||||
void alarm_thread_start(void);
|
||||
void poll_kick(void);
|
||||
int poll_wait_tick(void);
|
||||
int sig_default_kills(int sig);
|
||||
int proc_exists(int);
|
||||
int proc_num(void);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ struct file {
|
|||
int memfd_seg;
|
||||
struct evobj *ev;
|
||||
uint64 off;
|
||||
// What /proc/<pid>/fd shows. `ino` names the open thing (one per socket,
|
||||
// one per pipe); `path` is the absolute path an inode was opened by, as
|
||||
// written -- symlinks along it are not resolved. kmalloc'd, or 0.
|
||||
uint64 ino;
|
||||
char *path;
|
||||
struct file *fnext; // file.c's free list, while ref is 0
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -330,6 +330,9 @@ struct socket {
|
|||
// bidirectional connection.
|
||||
struct socket *peer;
|
||||
int peer_closed;
|
||||
// shutdown(SHUT_WR): this end has said all it will. The peer reads EOF but
|
||||
// can still answer, which is what a request/response helper depends on.
|
||||
int wr_shut;
|
||||
|
||||
char data[SOCKBUF];
|
||||
uint nread, nwrite;
|
||||
|
|
|
|||
Loading…
Reference in a new issue