server: Verify that the client is using a supported CPU type.
This commit is contained in:
parent
653d2c4a8d
commit
279defe66e
|
@ -1053,6 +1053,15 @@ size_t server_init_thread( void *entry_point )
|
|||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
if (ret) server_protocol_error( "init_thread failed with status %x\n", ret );
|
||||
if (ret)
|
||||
{
|
||||
if (ret == STATUS_NOT_SUPPORTED)
|
||||
{
|
||||
static const char * const cpu_arch[] = { "x86", "x86_64", "Alpha", "PowerPC", "Sparc" };
|
||||
server_protocol_error( "the running wineserver doesn't support the %s architecture.\n",
|
||||
cpu_arch[client_cpu] );
|
||||
}
|
||||
else server_protocol_error( "init_thread failed with status %x\n", ret );
|
||||
}
|
||||
return info_size;
|
||||
}
|
||||
|
|
|
@ -584,6 +584,8 @@ struct init_thread_reply
|
|||
timeout_t server_start;
|
||||
data_size_t info_size;
|
||||
int version;
|
||||
unsigned int all_cpus;
|
||||
char __pad_36[4];
|
||||
};
|
||||
|
||||
|
||||
|
@ -5222,6 +5224,6 @@ union generic_reply
|
|||
struct set_window_layered_info_reply set_window_layered_info_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 383
|
||||
#define SERVER_PROTOCOL_VERSION 384
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -568,6 +568,7 @@ typedef union
|
|||
timeout_t server_start; /* server start time */
|
||||
data_size_t info_size; /* total size of startup info */
|
||||
int version; /* protocol version */
|
||||
unsigned int all_cpus; /* bitset of supported CPUs */
|
||||
@END
|
||||
|
||||
|
||||
|
|
|
@ -670,7 +670,8 @@ C_ASSERT( FIELD_OFFSET(struct init_thread_reply, tid) == 12 );
|
|||
C_ASSERT( FIELD_OFFSET(struct init_thread_reply, server_start) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct init_thread_reply, info_size) == 24 );
|
||||
C_ASSERT( FIELD_OFFSET(struct init_thread_reply, version) == 28 );
|
||||
C_ASSERT( sizeof(struct init_thread_reply) == 32 );
|
||||
C_ASSERT( FIELD_OFFSET(struct init_thread_reply, all_cpus) == 32 );
|
||||
C_ASSERT( sizeof(struct init_thread_reply) == 40 );
|
||||
C_ASSERT( FIELD_OFFSET(struct terminate_process_request, handle) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct terminate_process_request, exit_code) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct terminate_process_reply, self) == 8 );
|
||||
|
|
|
@ -50,6 +50,21 @@
|
|||
#include "security.h"
|
||||
|
||||
|
||||
#define CPU_FLAG(cpu) (1 << (cpu))
|
||||
#ifdef __i386__
|
||||
static const unsigned int supported_cpus = CPU_FLAG(CPU_x86);
|
||||
#elif defined(__x86_64__)
|
||||
static const unsigned int supported_cpus = CPU_FLAG(CPU_x86_64) | CPU_FLAG(CPU_x86);
|
||||
#elif defined(__ALPHA__)
|
||||
static const unsigned int supported_cpus = CPU_FLAG(CPU_ALPHA);
|
||||
#elif defined(__powerpc__)
|
||||
static const unsigned int supported_cpus = CPU_FLAG(CPU_POWERPC);
|
||||
#elif defined(__sparc__)
|
||||
static const unsigned int supported_cpus = CPU_FLAG(CPU_SPARC);
|
||||
#else
|
||||
#error Unsupported CPU
|
||||
#endif
|
||||
|
||||
/* thread queues */
|
||||
|
||||
struct thread_wait
|
||||
|
@ -1043,6 +1058,11 @@ DECL_HANDLER(init_thread)
|
|||
|
||||
if (!process->peb) /* first thread, initialize the process too */
|
||||
{
|
||||
if (!CPU_FLAG(req->cpu) || !(supported_cpus & CPU_FLAG(req->cpu)))
|
||||
{
|
||||
set_error( STATUS_NOT_SUPPORTED );
|
||||
return;
|
||||
}
|
||||
process->unix_pid = current->unix_pid;
|
||||
process->peb = req->entry;
|
||||
process->cpu = req->cpu;
|
||||
|
@ -1066,6 +1086,7 @@ DECL_HANDLER(init_thread)
|
|||
reply->tid = get_thread_id( current );
|
||||
reply->version = SERVER_PROTOCOL_VERSION;
|
||||
reply->server_start = server_start_time;
|
||||
reply->all_cpus = supported_cpus;
|
||||
return;
|
||||
|
||||
error:
|
||||
|
|
|
@ -1019,7 +1019,8 @@ static void dump_init_thread_reply( const struct init_thread_reply *req )
|
|||
dump_timeout( &req->server_start );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " info_size=%u,", req->info_size );
|
||||
fprintf( stderr, " version=%d", req->version );
|
||||
fprintf( stderr, " version=%d,", req->version );
|
||||
fprintf( stderr, " all_cpus=%08x", req->all_cpus );
|
||||
}
|
||||
|
||||
static void dump_terminate_process_request( const struct terminate_process_request *req )
|
||||
|
|
Loading…
Reference in New Issue